示例#1
0
        public ActionResult Delete(string userId, string roleId, string masterRoleId = null, string masterUserId = null)
        {
            UserRoleItemModel userRoleItemModel = new UserRoleItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                UserRole             = new UserRoleViewModel(),
                ControllerAction     = "Delete",
                MasterRoleId         = masterRoleId, MasterUserId = masterUserId
            };

            try
            {
                if (IsDelete(userRoleItemModel.OperationResult))
                {
                    UserRole userRole = Repository.GetById(new object[] { userId, roleId });
                    if (userRole != null)
                    {
                        userRoleItemModel.UserRole = new UserRoleViewModel(userRole);
                    }
                }
            }
            catch (Exception exception)
            {
                userRoleItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(userRoleItemModel));
        }
示例#2
0
        public ActionResult Update(UserRoleItemModel userRoleItemModel)
        {
            try
            {
                if (IsUpdate(userRoleItemModel.OperationResult))
                {
                    if (ValidateModelState(Repository))
                    {
                        if (Repository.Update(userRoleItemModel.OperationResult, (UserRole)userRoleItemModel.UserRole.ToData()))
                        {
                            if (UnitOfWork.Save(userRoleItemModel.OperationResult))
                            {
                                return(JsonResultSuccess(new { uri = ReadUrlDictionary() }));
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                userRoleItemModel.OperationResult.ParseException(exception);
            }

            return(JsonResultOperationResult(userRoleItemModel.OperationResult));
        }
示例#3
0
        public ActionResult Update(UserRoleItemModel userRoleItemModel)
        {
            try
            {
                if (IsUpdate(userRoleItemModel.OperationResult))
                {
                    if (ValidateModelState(Repository))
                    {
                        if (Repository.Update(userRoleItemModel.OperationResult, (UserRole)userRoleItemModel.UserRole.ToData()))
                        {
                            if (UnitOfWork.Save(userRoleItemModel.OperationResult))
                            {
                                return(RedirectToUrlDictionary());
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                userRoleItemModel.OperationResult.ParseException(exception);
            }

            userRoleItemModel.IsSecurityOperations = IsSecurityOperations;

            return(View(userRoleItemModel));
        }
示例#4
0
        public ActionResult Create(string masterRoleId = null, string masterUserId = null)
        {
            UserRoleItemModel userRoleItemModel = new UserRoleItemModel()
            {
                IsSecurityOperations = this.IsSecurityOperations,
                UserRole             = new UserRoleViewModel(),
                ControllerAction     = "Create",
                MasterRoleId         = masterRoleId, MasterUserId = masterUserId
            };

            try
            {
                IsCreate(userRoleItemModel.OperationResult);
            }
            catch (Exception exception)
            {
                userRoleItemModel.OperationResult.ParseException(exception);
            }

            return(PartialView(userRoleItemModel));
        }