Try this
In manage.cshtml:
@using (Html.BeginForm(new { eid = ViewBag.EventId }))
{
@Html.ValidationSummary(true)
In controller
[HttpPost]
public ActionResult Manage(UpdateUserDetailsModel model,int eid)
{
if (ModelState.IsValid)
{
var updateModel = AutoMapper.Mapper.Map<Models.UpdateUserDetailsModel,KPAD_Api.Kiosk.KioskUserDetailsExtended>(model);
try
{
long token = Proxy.Proxy.Instance.Token[KioskUser.Id];
var result = Proxy.Proxy.Instance.KioskUserClient.UpdateKioskUser(updateModel, token);
if (result.ErrorCode == ReturnCodes.Codes.ALL_OK)
return RedirectToAction("Manage", new { Message = ManageMessageId.UpdateDetailsObjSuccess });
else
ModelState.AddModelError(ReturnCodes.Instance.GetMessage(result.ErrorCode), new Exception(ReturnCodes.Instance.GetMessage(result.ErrorCode)));
}
catch (Exception e)
{
ModelState.AddModelError("","Database error occured.Please contact the website administrator");
}
}
else
{
ModelState.AddModelError("","An unknown error occurend. Please try again. If it persists please contact the admin.");
}
// If we got this far, something failed, redisplay form
return View(model);
}
it's bind the error in key- value pair.