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)); }