Exemplo n.º 1
0
 public async Task <List <Models.Delivery> > GetDeliveries(DTO.DeliveryFilter filter)
 {
     return(await deliveriesDbContext.Delivery
            .Where(o => (filter.Today && o.DeliveryRequestedDate.Date == DateTime.Today) || !filter.Today)
            .Where(o => (filter.IdRider.HasValue && filter.IdRider.Value == o.IdRider) || !filter.IdRider.HasValue)
            .Where(o => (filter.Status.HasValue && (int)filter.Status.Value == o.IdStatus) || !filter.Status.HasValue)
            .ToListAsync());
 }
Exemplo n.º 2
0
        public async Task <IActionResult> GetDeliveries([FromQuery] DTO.DeliveryFilter filter)
        {
            var result = await deliveryService.GetDeliveries(filter);

            return(Ok(result));
        }