I have created an Edit Action method but it is not going inside ModelState.isValid. How can I check the error?
public PartialViewResult UpdateAccountDetails(string accountNumber)
{
CreditReportService crService = new CreditReportService();
AccountInfo account = new AccountInfo();
account.Account = service.GetAccountDetails(accountNumber);
account.AccountStatuses = service.GetAccountStatuses();
account.AccountTypes = service.GetAccountTypes();
account.CreditTerms = service.GetCreditTerms();
return PartialView("_UpdateAccountDetails", account);
}
[HttpPost]
public ActionResult UpdateAccountDetails(Account account)
{
if (ModelState.IsValid)
{
service.SaveAccount(account);
TempData["message"] = "Account has been updated successfully!";
AccountInfo accountInfo = new AccountInfo();
accountInfo.AccountStatuses = service.GetAccountStatuses();
accountInfo.AccountTypes = service.GetAccountTypes();
accountInfo.CreditTerms = service.GetCreditTerms();
return PartialView("_UpdateAccountDetails", accountInfo);
}
else
{
return PartialView("_UpdateAccountDetails", account);
}
}