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)); }
public ActionResult Add() { ViewBag.Title = "Add User"; ViewBag.ListRole = new SelectList(MRoleRepo.get(), "id", "name"); ViewBag.ListEmployee = new SelectList(MEmployeeRepo.getDataNonUser(), "id", "FullName"); return(PartialView("_Add")); }
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 List() { ViewBag.Title = "List Employee"; List <MEmployeeVM> item = MEmployeeRepo.get(); return(PartialView("_List", item)); }
public ActionResult Edit(MEmployeeVM model) { ViewBag.ListCompany = new SelectList(MEmployeeRepo.get(), "id", "name"); 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.update(model); var result = new { success = false, alertType = "success", alertStrong = "Data Updated !", alertMessage = "Data Updated! Data employee has been Updated" }; return(Json(result, JsonRequestBehavior.AllowGet)); } return(PartialView(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 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)); }
public ActionResult Edit(int id) { var data = MUserRepo.getById(id); ViewBag.Title = "Edit User - " + data.firtsName + " " + data.lastName + "(" + data.username + ")"; ViewBag.ListRole = new SelectList(MRoleRepo.get(), "id", "name"); ViewBag.ListEmployee = new SelectList(MEmployeeRepo.getDataNonUser(), "id", "FullName"); return(PartialView("_Edit", data)); }
public ActionResult Details(int id) { var data = MUserRepo.getById(id); ViewBag.Title = "View User - " + data.firtsName + " " + data.lastName + "(" + data.username + ")"; ViewBag.ListRole = new SelectList(MRoleRepo.get(), "id", "name"); ViewBag.ListEmployee = new SelectList(MEmployeeRepo.get(), "id", "fullName"); return(PartialView("_Details", data)); }
public ActionResult GetById2(int id) { var data = new { obj = MEmployeeRepo.getbyid(id) }; return(Json(data, JsonRequestBehavior.AllowGet)); }
public ActionResult Detail(int id) { MEmployeeVM model = MEmployeeRepo.GetDetail(id); ViewBag.Title = "View Company-" + model.first_name + model.last_name + "(" + model.employee_number + ")"; return(PartialView(model)); }
// GET: m_employee public ActionResult Index() { ViewBag.Title = "List Employee"; ViewBag.ListCompanyName = new SelectList(MEmployeeRepo.get(), "NmCompany", "NmCompany"); List <MEmployeeVM> item = MEmployeeRepo.get(); return(View(item)); }
public JsonResult CheckNama(string nama) { var result = new { success = true, data = MEmployeeRepo.CheckNama(nama), alertType = "error", alertStrong = "Error !", alertMessage = "Your Data with name </strong>(" + nama + ")</strong>Has been created" }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Delete(int id) { MEmployeeVM model = MEmployeeRepo.getbyid(id); MEmployeeRepo.Delete(id); var result = new { success = true, alertType = "info", alertStrong = "Data Deleted !", alertMessage = "Data Deleted! Data Company With Employee ID Number" + model.employee_number + "Has been deleted" }; return(Json(result, JsonRequestBehavior.AllowGet)); }
public ActionResult Add(MUserVM model) { if (ModelState.IsValid && MUserRepo.insert(model)) { var result = new { success = true, message = "Data Saved! New User has been add with username " + model.username, vclass = "alert alert-info" }; return(Json(result, JsonRequestBehavior.AllowGet)); } ViewBag.Title = "Add User"; ViewBag.ListRole = new SelectList(MRoleRepo.get(), "id", "name"); ViewBag.ListEmployee = new SelectList(MEmployeeRepo.getDataNonUser(), "id", "FullName"); return(PartialView("_Add", model)); }
public ActionResult Edit(MUserVM model) { var data = MUserRepo.getById(model.id); if (ModelState.IsValid && MUserRepo.update(model)) { var result = new { success = true, message = "Data Updated! Data User has been updated !", vclass = "alert alert-info" }; return(Json(result, JsonRequestBehavior.AllowGet)); } ViewBag.Title = "Edit User - " + data.firtsName + " " + data.lastName + "(" + data.username + ")"; ViewBag.ListRole = new SelectList(MRoleRepo.get(), "id", "name"); ViewBag.ListEmployee = new SelectList(MEmployeeRepo.getDataNonUser(), "id", "FullName"); return(PartialView("_Edit", model)); }