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() { 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: 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 ActionResult List() { List <MCompanyVM> item = MCompanyRepo.get(); return(PartialView("_List", item)); }