public async Task <GroupDTO> GetGroupByIdAsync(Guid id) { var grups = await _context.Group.Where(c => c.id == id).Include(c => c.ProfessionDB).Include(c => c.SpecializationDB).FirstOrDefaultAsync(); GroupDTO groupsDTO = new GroupDTO(); groupsDTO.GroupDBtoGroupDTO(grups); return(groupsDTO); }
public async Task <List <GroupDTO> > GetAllGroupsAsync() { var grups = await _context.Group.Include(c => c.ProfessionDB).Include(c => c.SpecializationDB).ToListAsync(); List <GroupDTO> groupsDTO = new List <GroupDTO>(); foreach (var g in grups) { GroupDTO groupDTO = new GroupDTO(); groupDTO.GroupDBtoGroupDTO(g); groupsDTO.Add(groupDTO); } return(groupsDTO); }