public ActionResult Edit(MCompanyVM model) { if (ModelState.IsValid) { if (MCompanyRepo.CheckCompany(model) == true) { var result = new { success = true, alertType = "warning", alertStrong = "Error !", alertMessage = "Company Already Created" }; return(Json(result, JsonRequestBehavior.AllowGet)); } else if (MCompanyRepo.CheckCompany(model) == false) { MCompanyRepo.update(model); var result = new { success = false, alertType = "success", alertStrong = "Data Updated !", alertMessage = "Data company has been Updated" }; return(Json(result, JsonRequestBehavior.AllowGet)); } } return(PartialView(model)); }
public ActionResult Add(MCompanyVM model) { if (ModelState.IsValid) { if (MCompanyRepo.CheckCompany(model) == true) { var result = new { success = true, alertType = "warning", alertStrong = "Error !", alertMessage = "Company Already Created" }; return(Json(result, JsonRequestBehavior.AllowGet)); } else if (MCompanyRepo.CheckCompany(model) == false) { MCompanyRepo.insert(model); var result = new { success = false, alertType = "success", alertStrong = "Data Saved !", alertMessage = "New company has been add with Code" + model.code }; return(Json(result, JsonRequestBehavior.AllowGet)); } } return(PartialView("_Add", model)); }