public async Task <PagedResult <ParcelDto> > BrowseAsync(BrowseParcels query) { await Task.CompletedTask; return(parcels.Select(x => new ParcelDto { Id = x.Id, Name = x.Name, SentAt = x.SentAt, Received = x.RecivedAt.HasValue, }).Paginate(query)); }
public async Task <PagedResult <ParcelDto> > BrowseAsync(BrowseParcels query) { await Task.CompletedTask; var parcels = _parcels.AsEnumerable(); if (query.Mine) { parcels = parcels.Where(x => x.SenderId == query.UserId); } return(parcels.Select(x => new ParcelDto { Id = x.Id, Name = x.Name, SentAt = x.SentAt, Received = x.ReceivedAt.HasValue, }) .Paginate(query)); }
public async Task <IActionResult> Get([FromQuery] BrowseParcels query) { return(Ok(await parcelService.BrowseAsync(query))); }