Beispiel #1
0
        public ActionResult ViewPermissions()
        {
            FASM_EN.User.Roles eRoles = new FASM_EN.User.Roles();
            int RoleId = Convert.ToInt32(Url.RequestContext.RouteData.Values["Id"]);

            ViewBag.RoleId = RoleId; eRoles.RoleId = RoleId;
            RolesBI.LoadRoles(ref eRoles);
            ViewBag.RoleName = eRoles.RoleName;
            Permissions ePermissions = new Permissions();

            ePermissions.dtPermissions = PermissionsBI.GetPermissions(RoleId);
            return(View(ePermissions));
        }
Beispiel #2
0
        public ActionResult EditRoles(FASM_EN.User.Roles eRoles)
        {
            if (eRoles.isLoad == false)
            {
                eRoles.RoleId = Convert.ToInt32(Request.Params["RoleId"]);
                RolesBI.LoadRoles(ref eRoles);
                return(PartialView(eRoles));
            }
            else
            {
                string message = "";
                if (ModelState.IsValid)
                {
                    try
                    {
                        FASM_Enums.InfoMessages Results = RolesBI.SaveRoles(ref eRoles);

                        switch (Results)
                        {
                        case FASM_Enums.InfoMessages.Success:
                            message = FASM_Msg.Updated;
                            break;

                        case FASM_Enums.InfoMessages.AlreadyExist:
                            message = "Sorry! the role name already exist";
                            break;
                        }
                        return(Json(new { msg = message, JsonRequestBehavior.AllowGet }));
                    }
                    catch (Exception ex)
                    {
                        ViewBag.CatchedMsg = ex.Message;
                    }
                }
            }

            return(View(eRoles));
        }