コード例 #1
0
        public async Task <IReadOnlyList <Order> > GetOrdersForUserAsync(string buyerEmail)
        {
            var orderRepositoryObject = new OrderRepositoryObject
            {
                BuyerEmail = buyerEmail
            };

            return(await _unitOfWork.Repository <Order>().GetAllAsync(orderRepositoryObject));
        }
コード例 #2
0
        private IQueryable <Order> GetOrderQuery(OrderRepositoryObject orderRepositoryObject)
        {
            var query = _context.Orders
                        .Include(i => i.OrderItems)
                        .Include(d => d.DeliveryMethod)
                        .AsQueryable();

            if (!string.IsNullOrEmpty(orderRepositoryObject?.BuyerEmail))
            {
                query.Where(e => e.BuyerEmail == orderRepositoryObject.BuyerEmail);
            }

            return(query);
        }