예제 #1
0
        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));
        }
예제 #2
0
        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));
        }
예제 #3
0
 public async Task <IActionResult> Get([FromQuery] BrowseParcels query)
 {
     return(Ok(await parcelService.BrowseAsync(query)));
 }