Beispiel #1
0
 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"));
 }
Beispiel #2
0
 // GET: MMenuAccess
 public ActionResult Index()
 {
     ViewBag.ListCode = new SelectList(MRoleRepo.get(), "code", "code");
     ViewBag.ListName = new SelectList(MRoleRepo.get(), "name", "name");
     ViewBag.Title    = "List Menu Access";
     return(View(MRoleRepo.get()));
 }
 public ActionResult Add(MRoleVM model)
 {
     if (ModelState.IsValid)
     {
         if (MRoleRepo.CekNama(model) == true)
         {
             var result = new
             {
                 success      = false,
                 alertType    = "error",
                 alertStrong  = "Error!",
                 alertMessage = "Role name already used"
             };
             return(Json(result, JsonRequestBehavior.AllowGet));
         }
         else if (MRoleRepo.CekNama(model) == false)
         {
             MRoleRepo.insert(model);
             var result = new
             {
                 success      = true,
                 alertType    = "info",
                 alertStrong  = "Data Saved !",
                 alertMessage = "New role has been added with code " + model.code + " !"
             };
             return(Json(result, JsonRequestBehavior.AllowGet));
         }
     }
     return(PartialView("_Add", model));
 }
Beispiel #4
0
 public ActionResult Add()
 {
     ViewBag.Title    = "Add List Menu Access";
     ViewBag.ListMenu = new SelectList(MMenuRepo.get(), "id", "name");
     ViewBag.ListRole = new SelectList(MRoleRepo.get(), "id", "name");
     return(PartialView("_Add"));
 }
        public ActionResult Add()
        {
            MRoleVM model = new MRoleVM();

            model.code = MRoleRepo.NewCode();
            return(PartialView("_Add", model));
        }
Beispiel #6
0
        public ActionResult Details(int idRole)
        {
            var data = MRoleRepo.getByIdRole(idRole);

            ViewBag.Title = "View Menu Access - " + data.role.name + " (" + data.role.code + ")";
            return(PartialView("_Details", data));
        }
 public ActionResult Edit(MRoleVM model)
 {
     if (ModelState.IsValid)
     {
         if (MRoleRepo.CekNama2(model) == true)
         {
             var result = new
             {
                 success      = false,
                 alertType    = "error",
                 alertStrong  = "Error!",
                 alertMessage = "Role name already used"
             };
             return(Json(result, JsonRequestBehavior.AllowGet));
         }
         else if (MRoleRepo.CekNama2(model) == false)
         {
             MRoleRepo.Edit(model);
             var result = new
             {
                 success      = true,
                 alertType    = "info",
                 alertStrong  = "Data Updated !",
                 alertMessage = "Data Role has been updated !"
             };
             return(Json(result, JsonRequestBehavior.AllowGet));
         }
     }
     return(PartialView("_Edit", model));
 }
Beispiel #8
0
 // 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()));
 }
        // GET: Role_
        public ActionResult Index()
        {
            ViewBag.ListCode = new SelectList(MRoleRepo.get(), "code", "code");
            ViewBag.ListName = new SelectList(MRoleRepo.get(), "name", "name");
            List <MRoleVM> data = MRoleRepo.get();

            return(View(data));
        }
Beispiel #10
0
        public ActionResult Details(int idRole)
        {
            ViewBag.ListMenu = new SelectList(MMenuRepo.get(), "id", "name");
            ViewBag.ListRole = new SelectList(MRoleRepo.get(), "id", "code");
            var data = MRoleRepo.getByIdRole(idRole);

            ViewBag.Title = "View Menu Access - " + data.role.name + " (" + data.role.code + ")";
            return(PartialView("_Details", data));
        }
Beispiel #11
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));
        }
Beispiel #12
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));
        }
Beispiel #13
0
        public ActionResult Edit(int idRole)
        {
            var data = MRoleRepo.getByIdRole(idRole);

            ViewBag.Title    = "Update Menu Access - " + data.role.name + " (" + data.role.code + ")";
            ViewBag.ListMenu = new SelectList(MMenuRepo.get(), "id", "name");
            ViewBag.ListRole = new SelectList(MRoleRepo.get(), "id", "code");
            return(PartialView("_Edit", data));
        }
        public JsonResult CekNama(string nama)
        {
            var result = new
            {
                success      = true,
                data         = MRoleRepo.CekNama(nama),
                alertType    = "warning",
                alertStrong  = "Error !",
                alertMessage = "Role name with name </strong>" + nama + "</strong> already used"
            };

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
        public ActionResult HideRole(int id)
        {
            if (MRoleRepo.hiddenRole(id) == true)
            {
                var result = new
                {
                    success = true,
                    message = "Data Berhasil Di Delete"
                };
                return(Json(result, JsonRequestBehavior.AllowGet));
            }

            return(RedirectToAction("index"));
        }
Beispiel #16
0
 public ActionResult Add(MMenuAccessVM model)
 {
     if (ModelState.IsValid && MRoleRepo.insert(model))
     {
         var result = new
         {
             success = true,
             message = "Data Saved! New menu access for role " + model.role.name + " has been added !",
             vClass  = "alert alert-info"
         };
         return(Json(result, JsonRequestBehavior.AllowGet));
     }
     ViewBag.Title    = "Add List Menu Access";
     ViewBag.ListMenu = new SelectList(MMenuRepo.get(), "id", "name");
     ViewBag.ListRole = new SelectList(MRoleRepo.get(), "id", "name");
     return(PartialView("_Add", model));
 }
Beispiel #17
0
        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));
        }
Beispiel #18
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));
        }
Beispiel #19
0
        public ActionResult Edit(MMenuAccessVM model)
        {
            var data = MRoleRepo.getByIdRole(model.role.id);
            var user = User.Identity.Name;

            if (ModelState.IsValid && MRoleRepo.update(model))
            {
                var res = new
                {
                    success = true,
                    message = "Data Updated! Menu access for " + data.role.name + " has been updated !",
                    vClass  = "alert alert-info"
                };
                return(Json(res, JsonRequestBehavior.AllowGet));
            }

            ViewBag.Title    = "Update Menu Access - " + data.role.name + " (" + data.role.code + ")";
            ViewBag.ListMenu = new SelectList(MMenuRepo.get(), "id", "name");
            ViewBag.ListRole = new SelectList(MRoleRepo.get(), "id", "name");
            return(PartialView("_Edit"));
        }
Beispiel #20
0
 public ActionResult List()
 {
     return(PartialView("_List", MRoleRepo.get()));
 }
        public ActionResult Detail(int id)
        {
            MRoleVM role = MRoleRepo.getById(id);

            return(PartialView("_Detail", role));
        }
        public ActionResult List()
        {
            List <MRoleVM> data = MRoleRepo.get();

            return(PartialView("_List", data));
        }
 public ActionResult Edit(int id)
 {
     return(PartialView("_Edit", MRoleRepo.getById(id)));
 }