public JsonResult Add(AddViewModel model) { var identityManager = new AspNetIdentiyAuthorizeRelay <SysUser>(); if (!identityManager.RoleExists(model.SysRole.Name)) { identityManager.CreateRole(this.CurrentUserId, model.SysRole); return(Json(ResultType.Success, ManagerOperateTipUtils.ADD_SUCCESS)); } else { return(Json(ResultType.Failure, ManagerOperateTipUtils.ROLE_EXISTS)); } }
public JsonResult Add(RoleModel model) { var identityManager = new AspNetIdentiyAuthorizeRelay <SysUser>(CurrentDb); if (!identityManager.RoleExists(model.Name)) { SysRole role = new SysRole(); role.PId = model.PId; role.Name = model.Name; role.Description = model.Description; identityManager.CreateRole(role); return(Json(ResultType.Success, ManagerOperateTipUtils.ADD_SUCCESS)); } else { return(Json(ResultType.Failure, ManagerOperateTipUtils.ROLE_EXISTS)); } }