public IEnumerable<Order> GetOrders(OrderRequest request)
        {
            //Database.SetInitializer(new EntitiesContextInitializer());

            var res = _repository.GetOrders(request).ToList();
            return res;
        }
Exemplo n.º 2
0
        public IEnumerable<Order> GetOrders(OrderRequest request)
        {
            var result = _dataContext.Orders as IQueryable<Order>;

            if (request.IncludeOrderItems)
            {
                result = result.Include("OrderItems");
                result = result.Include("OrderItems.Product");
                result = result.Include("OrderItems.Order");
            }

            if (request.IncludeCustomer)
            {
                result = result.Include("Customer");
            }

            return result;
        }
 //TODO важно! метод должен возвращать Task<List<Order>>, а не List<Order>
 public Task<List<Order>> GetOrdersAsync(OrderRequest request)
 {
     return _serviceClient.GetOrdersAsync(request);
 }