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 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)); }
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)); }
public ActionResult Add(MEmployeeVM model) { ViewBag.ListCompany = new SelectList(MCompanyRepo.get(), "id", "name"); if (ModelState.IsValid) { if (MEmployeeRepo.HitungEmplo(model) == true) { var result = new { success = true, alertType = "warning", alertStrong = "Error!", alertMessage = "Employee number already used" }; return(Json(result, JsonRequestBehavior.AllowGet)); } else if (MEmployeeRepo.HitungEmplo(model) == false) { MEmployeeRepo.insert(model); var result = new { success = false, alertType = "success", alertStrong = "Data Saved !", alertMessage = "New Employee has been add with employee ID number" + model.employee_number }; return(Json(result, JsonRequestBehavior.AllowGet)); } } return(PartialView("_Add", model)); }
// GET: MUser public ActionResult Index() { ViewBag.Title = "List User"; ViewBag.ListRole = new SelectList(MRoleRepo.get(), "name", "name"); ViewBag.ListEmployee = new SelectList(MEmployeeRepo.get(), "FullName", "FullName"); ViewBag.ListCompany = new SelectList(MCompanyRepo.get(), "name", "name"); return(View(MUserRepo.get())); }
public ActionResult Add() { MCompanyVM model = new MCompanyVM(); model.code = MCompanyRepo.KodeAuto(); ViewBag.Title = "Add"; return(PartialView("_Add", model)); }
public ActionResult Add() { MEmployeeVM model = new MEmployeeVM(); ViewBag.ListCompany = new SelectList(MCompanyRepo.get(), "id", "name"); ViewBag.Title = "Add"; return(PartialView("_Add", model)); }
public ActionResult Edit(int id) { ViewBag.ListCompany = new SelectList(MCompanyRepo.get(), "id", "name"); MEmployeeVM model = MEmployeeRepo.getbyid(id); ViewBag.Title = "Edit Company-" + model.first_name + model.last_name + "(" + model.employee_number + ")"; return(PartialView(model)); }
// GET: Ajax public ActionResult GetById(int id) { var data = new { obj = MCompanyRepo.getbyid(id) }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Detail(int id) { MCompanyVM model = MCompanyRepo.GetDetail(id); ViewBag.Title = "View Company-" + model.name + "(" + model.code + ")"; return(PartialView(model)); }
// GET: m_company public ActionResult Index() { ViewBag.Title = "List Company"; ViewBag.ListCompanyCode = new SelectList(MCompanyRepo.get(), "code", "code"); ViewBag.ListCompanyName = new SelectList(MCompanyRepo.get(), "name", "name"); List <MCompanyVM> item = MCompanyRepo.get(); return(View(item)); }
public JsonResult CheckNama(string nama) { var result = new { success = true, data = MCompanyRepo.CheckNameCompany(nama), alertType = "error", alertStrong = "Error !", alertMessage = "Your Data with name </strong>(" + nama + ")</strong>Has been created" }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Edit(int id) { MCompanyVM model = MCompanyRepo.getbyid(id); return(PartialView(model)); }
public ActionResult List() { List <MCompanyVM> item = MCompanyRepo.get(); return(PartialView("_List", item)); }