public ActionResult Create(DoctorVM doctor) { try { if (ModelState.IsValid) { IBL bL = new BlClass(); Dictionary <string, string> errorMessege = bL.PersonValidation(doctor.Current); if (errorMessege.Count == 0) { bL.AddDoctor(doctor.Current); ViewBag.TitlePopUp = "עבר בהצלחה"; ViewBag.Message = "הרופא.ה התווספ.ה בהצלחה למאגר הרופאים"; return(View("Index", new DoctorModel().getDoctorVms())); } foreach (var item in errorMessege) { ModelState.AddModelError(item.Key, item.Value); } } return(View(doctor)); } catch (Exception ex) { ViewBag.TitlePopUp = "שגיאה"; ViewBag.Message = ex.Message; return(View("Index", new DoctorModel().getDoctorVms())); } }
public ActionResult Create(PatientVM patient) { try { if (ModelState.IsValid) { IBL bL = new BlClass(); Dictionary <string, string> errorMessege = bL.PersonValidation(patient.Current); if (errorMessege.Count == 0) { bL.AddPatient(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())); } }