0
我想在數據庫中添加用戶詳細信息。我創建新的用戶名和密碼,然後它會轉到詳細信息頁面。在此詳細信息頁面中,詳細信息將添加到數據庫中。但我的問題是什麼意思的細節不能正確添加。如何在mvc中添加詳細信息
在我的控制器
我的代碼是
INT candidateId;
[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。但細節不會添加到數據庫。它顯示爲空。任何人都可以澄清我這一個?
是的。所有的控件都只在同一個表單中。 – Duk