public async Task <CartableDto> GetById(int caseId) { var userId = userContext.CurrentUser.UserId; var @case = await caseRepository.Get().Include(a => a.Tracks).Include(b => b.FlowParameters).FirstOrDefaultAsync(a => a.Id == caseId); return(CartableDto.ConvertToDto(@case)); }
public async Task <(IEnumerable <CartableDto>, int totalCount)> GetByUser(int pageNumber, int pageSize) { var userId = userContext.CurrentUser.UserId; var query = caseRepository.Get().Include(a => a.Tracks).Include(b => b.FlowParameters).Where(c => c.Tracks.Any(t => t.IsLatestTrack && t.CurrentUserId == userId)); var cartables = await query.OrderBy(t => t.Id).Page(pageNumber, pageSize).ToListAsync(); var cartableDtos = cartables.Select(a => CartableDto.ConvertToDto(a)); return(cartableDtos, query.Count()); }