コード例 #1
0
        public ActionResult Delete(int id)
        {
            ViewBag.Title = "Delete Data?";
            var data = MUserRepo.getById(id);

            return(PartialView("_Delete", data));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        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));
        }
コード例 #4
0
        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));
        }