//POST insert new Patient public JsonResult Insert(Patient patient) { //Check Duplicate Record if (patient.FirstName == "" || patient.LastName == "" || patient.Gender == null || patient.DateOfBirth == null || patient.City == null || patient.State == null) { return(Json(new { success = "" })); } using (BLPatient blpatient = new BLPatient()) { int count = blpatient.GetDuplicatePatient(patient); if (count > 0) { return(Json(new { success = false })); } if (patient != null) { db.Patients.Add(patient); db.SaveChanges(); return(Json(new { success = true })); } else { return(Json(new { success = false })); } } return(Json("All Field Required", JsonRequestBehavior.AllowGet)); }
//GET Patient/GetPatient public JsonResult GetPatient() { List <Patient> empList = new List <Patient>(); using (BLPatient blpatient = new BLPatient()) { empList = blpatient.GetAllPatientRecord(); } return(Json(empList, JsonRequestBehavior.AllowGet)); }