public ActionResult Create(PrescriptionVM prescription) { try { if (ModelState.IsValid) { IBL bL = new BlClass(); prescription.DoctorId = RouteConfig.doctor != null ? RouteConfig.doctor.Id : -1; bL.AddPrescription(prescription.Current); ViewBag.TitlePopUp = "עבר בהצלחה"; ViewBag.Message = "המרשם נוסף בהצלחה"; var prescriptions = bL.GetPrescriptions(pre => pre.PatientId == prescription.PatientId).Select(pr => new PrescriptionVM(pr)); ViewBag.Patient = prescription.PatientId; return(View("Index", prescriptions)); } return(View(prescription)); } catch (System.Exception ex) { ViewBag.TitlePopUp = "שגיאה"; ViewBag.Message = ex.Message; return(View(prescription)); } }