データベースにユーザーの詳細を追加したい。新しいユーザー名とパスワードを作成すると、詳細ページに移動します。この詳細ページでは、詳細がデータベースに追加されます。しかし、私の問題は、詳細が正しく追加されていないことを意味します。
私のコントローラーで
私のコードは
int候補ID;
[HttpPost, HandleErrorWithAjaxFilter]
public ActionResult Add(FormCollection collection, HttpPostedFileBase resume)
{
if (LoggedInCandidate == null)
{
Candidate candidate = new Candidate();
candidate.Name = collection["Name"];
candidate.Email = collection["Email"];
candidate.Address = collection["Address"];
candidate.ContactNumber = collection["ContactNumber"];
candidate.MobileNumber = collection["MobileNumber"];
candidate.LicenseNumber = collection["LicenseNumber"];
int candidateId = _repository.AddCandidate(candidate);
}
else
{
candidateId = LoggedInCandidate.Id;
}
_repository.Save();
ここでは、データベースで Id を作成します。ただし、詳細はデータベースに追加されません。ヌルを示しています。誰かが私にこれを明確にすることができますか?