public ActionResult Edit(PatientVM patient) { try { if (ModelState.IsValid) { IBL bL = new BlClass(); Dictionary <string, string> errorMessege = bL.PersonValidation(patient.Current); if (errorMessege.Count == 0) { bL.UpdatePatient(patient.Current); ViewBag.TitlePopUp = "עבר בהצלחה"; ViewBag.Message = "המטופל.ת עודכנ.ה בהצלחה במאגר המטופלים"; return(View("Index", new PatientModel().getPatientVms())); } foreach (var item in errorMessege) { ModelState.AddModelError(item.Key, item.Value); } } return(View(patient)); } catch (Exception ex) { ViewBag.TitlePopUp = "שגיאה"; ViewBag.Message = ex.Message; return(View("Index", new PatientModel().getPatientVms())); } }