protected virtual async Task CreateRoleAsync(CreateOrUpdateRoleInput input) { var role = input.Role.MapTo<AuthorityRoleInfo>(); role.Id = GuidHelper.NewGuid(); role.OrgId =AbpSession.OrgId; await _roleRepository.InsertAsync(role); cacheHandler.Remove(CacheCategoryRole, "GetRoleList"); }
protected virtual async Task UpdateRoleAsync(CreateOrUpdateRoleInput input) { Debug.Assert(input.Role.Id != null, "input.Role.Id should be set."); var role = await _roleRepository.GetAsync(input.Role.Id); role = input.Role.MapTo<AuthorityRoleInfo>(); await _roleRepository.UpdateAsync(role); cacheHandler.Remove(CacheCategoryRole, "GetRoleList"); }
/// <summary> /// 添加修改实体 /// </summary> /// <param name="input"></param> /// <returns></returns> public async Task CreateOrUpdateRole(CreateOrUpdateRoleInput input) { if (input.Role.Id != null && input.Role.Id != Guid.Empty) { await UpdateRoleAsync(input); } else { await CreateRoleAsync(input); } }