public JsonResult Save(PatientViewModel model) { var isExist = PatientManager.CheckExistingPatient(model); if (isExist) { return(ErroResult(model.Name + " " + "Patient All ready Exist")); } int saveindex = 0; Patient _patient = new Patient(); _patient.PatientId = model.PatientId; _patient.Name = model.Name; _patient.Age = model.Age; _patient.PatientCode = model.PatientCode; _patient.Contact = model.Contact; _patient.Email = model.Email; _patient.SerialNumber = model.SerialNumber; _patient.Address = model.Address; _patient.CallingDate = model.CallingDate; _patient.VisitingtDate = model.VisitingtDate; _patient.AppionmentDate = model.AppionmentDate; _patient.GenderId = model.GenderId; _patient.DiseasesId = model.DiseasesId; saveindex = model.PatientId == 0 ? PatientManager.Save(_patient) : PatientManager.Edit(_patient); return(Reload(saveindex)); }
public ActionResult Manage(PatientViewModel vm) { try { _manager.Edit(vm.Patient); return(RedirectToAction("Manage", new { id = vm.Patient.Id, status = "success" })); } catch (Exception e) { return(RedirectToAction("Manage", new { id = vm.Patient.Id, status = "fail" })); } }