public async Task UpdateRoleAsync(RoleEditDto input) { var info = await _roleManage.GetRoleByIdAsync(input.Id); input.MapTo(info); await _roleManage.UpdateRoleAsync(info); }
public async Task Update(RoleEditDto input) { var rs = await _repository.FirstOrDefaultAsync(x => x.Id == input.Id); if (rs == null) { throw new UserFriendlyException(string.Format("There is no role with id : {0}", input.Id)); } input.MapTo(rs); var result = await _repository.FirstOrDefaultAsync(x => x.RoleCode == input.RoleCode); if (result != null && result.Id != input.Id) { throw new UserFriendlyException(string.Format(L("DuplicateRoleCode"), input.RoleCode)); } await _repository.UpdateAsync(rs); }
public async Task CreateRoleAsync(RoleEditDto input) { var info = input.MapTo <Role>(); await _roleManage.CreateRoleAsync(info); }