コード例 #1
0
        public JsonResult Update(RoleModel model)
        {
            var identityManager = new AspNetIdentiyAuthorizeRelay <SysUser>(CurrentDb);

            SysRole role = identityManager.RoleManager.FindById(model.Id);

            role.Name        = model.Name;
            role.Description = model.Description;

            identityManager.UpdateRole(role);
            return(Json(ResultType.Success, ManagerOperateTipUtils.UPDATE_SUCCESS));
        }
コード例 #2
0
        public JsonResult Edit(EditViewModel model)
        {
            var identityManager = new AspNetIdentiyAuthorizeRelay <SysUser>();

            var isExxistRoleName = CurrentDb.Roles.Where(m => m.Name == model.SysRole.Name && m.Id != model.SysRole.Id).FirstOrDefault();

            if (isExxistRoleName != null)
            {
                return(Json(ResultType.Failure, ManagerOperateTipUtils.ROLE_EXISTS));
            }
            identityManager.UpdateRole(this.CurrentUserId, model.SysRole);

            return(Json(ResultType.Success, ManagerOperateTipUtils.UPDATE_SUCCESS));
        }