public ActionResult Delete(int id) { MCompanyVM model = MCompanyRepo.getbyid(id); if (MEmployeeRepo.Hitung(model.id) == true) { var result = new { success = true, alertType = "warning", alertStrong = "Error!", alertMessage = "Company still has employees" }; return(Json(result, JsonRequestBehavior.AllowGet)); } else if (MEmployeeRepo.Hitung(model.id) == false) { MCompanyRepo.Delete(model); var result = new { success = false, alertType = "success", alertStrong = "Data Deleted !", alertMessage = "Data Deleted! Data Company With Code" + model.code + "Has been delete" }; return(Json(result, JsonRequestBehavior.AllowGet)); } return(PartialView("_Delete", model)); }
// GET: Ajax public ActionResult GetById(int id) { var data = new { obj = MCompanyRepo.getbyid(id) }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(int id) { MCompanyVM model = MCompanyRepo.getbyid(id); return(PartialView(model)); }