Hi,
I have created one form where i am saving the data using form, but when submit form and my ModelState is getting invalid and still i am not getting error message.
Please check and let me know what is wrong with my code.
public IActionResult Index(Student model)
{
if (ModelState.IsValid)
{
ProviderPersonalInfoUpdate modelinfo = new ProviderPersonalInfoUpdate();
modelinfo.UserId = model.ManageProvider.UserId;
modelinfo.FirstName = model.ManageProvider.FirstName;
modelinfo.MiddleName = model.ManageProvider.MiddleName;
modelinfo.LastName = model.ManageProvider.LastName;
modelinfo.DOB = dtdob;
modelinfo.Email = model.ManageProvider.Email;
modelinfo.StartDate = dtstartdate;
modelinfo.TaxID = model.ManageProvider.TaxID;
modelinfo.PTan = model.ManageProvider.PTan;
modelinfo.NPI = model.ManageProvider.NPI;
modelinfo.SSN = model.ManageProvider.SSN;
modelinfo.Phone = model.ManageProvider.Phone;
modelinfo.Fax = model.ManageProvider.Fax;
modelinfo.AddressLine1 = model.ManageProvider.AddressLine1;
modelinfo.AddressLine2 = model.ManageProvider.AddressLine2;
modelinfo.StateID = model.ManageProvider.StateID;
modelinfo.CityID = model.ManageProvider.CityID;
modelinfo.Zipcode = model.ManageProvider.Zipcode;
modelinfo.Website = model.ManageProvider.Website;
modelinfo.UserId = HttpContext.Request.Cookies["UserId"] != null ? HttpContext.Request.Cookies["UserId"].ToString() : "";
AccountApiCall accountApiCall = new AccountApiCall(Configuration["ABCAPI"]);
model.ManageProvider.createdBy = HttpContext.Request.Cookies["FullName"] != null ? HttpContext.Request.Cookies["FullName"].ToString() : "";
var Response = accountApiCall.PostAPIcall<GetProviderDetailModel>(modelinfo, "provider/personaldetailsupdate", HttpContext.Request.Cookies["Token"].ToString());
if (Response.status)
{
TempData["ProviderId"] = model.ManageProvider.UserId;
TempData.Keep("ProviderId");
return Json(Response);
}
else
{
return Json(Response);
}
}
else
{
return View("Index");
}
}
this is controller where i am getting ModelState invalid but still no error message is displaying