public async Task <GroupDTO> GetGroupByIdAsync(int id) { var group = await this.groupRepository.GetByIdAsync(id); if (group == null) { return(null); } var groupDto = GroupDTO.FromEntity(group); groupDto.UserDebts = this.userService.GetUserDebtsByGroupPerUrersAsync(groupDto); return(groupDto); }
public async Task <IList <GroupDTO> > GetGroupsAsync() { var groups = await this.groupRepository.GetAll().ToListAsync(); return(groups.Select(x => GroupDTO.FromEntity(x)).ToList()); }