async Task <GetCurbsideOrdersResponse> IDoCurbsideQueries.GetAll()
        {
            var response = new GetCurbsideOrdersResponse();
            var data     = await _context.CurbsideOrders.ToListAsync();

            response.Data = data;
            response.NumberOfApprovedOrders  = response.Data.Count(o => o.Status == CurbsideOrderStatus.Approved);
            response.NumberOfDeniedOrders    = response.Data.Count(o => o.Status == CurbsideOrderStatus.Denied);
            response.NumberOfFulfilledOrders = response.Data.Count(o => o.Status == CurbsideOrderStatus.Fulfilled);
            response.NumberOfPendingOrders   = response.Data.Count(o => o.Status == CurbsideOrderStatus.Pending);
            return(response);
        }
Пример #2
0
        public async Task <ActionResult> GetAllOrders()
        {
            GetCurbsideOrdersResponse response = await _curbsideQueries.GetAll();

            return(Ok(response));
        }