Please bear with my noobness, I\'m super new to the MVC pattern.
What I\'m trying to do
I am building a profile information page for re
In your [HttpPost]
profil function, if modelstate.isvalid
is false, you return your edit view, but you need to define your pmViewModel
again , other wise your partial view will not have an object to display. Try using the following and let us know what happens
[HttpPost]
[Authorize]
[ValidateAntiForgeryToken]
public ActionResult Profil(ProfileModel model)
{
if (ModelState.IsValid)
{
//insert into database
return Content("everything's good");
}
else
{
//outputs form errors
var pmViewModel = new ProfileUserViewModel
{
ProfileModelObject = profileModel,
UserModelObject = userModel
};
return View(model);
}
}