public ActionResult NewPatient() { Service serv = new Service(); ViewBag.City = serv.GetCity(); PatientViewModel patient = new PatientViewModel(); return PartialView("NewPatient", patient); }
public ActionResult NewPatient(PatientViewModel patient) { Service serv = new Service(); if (ModelState.IsValid) { serv.CreatePatient(patient); return Json(new { success = true}, JsonRequestBehavior.AllowGet); } else { ViewBag.City = serv.GetCity(); return Json(new { success = false, textError = "During save patient error" }, JsonRequestBehavior.AllowGet); } }