public IQueryable<Order> GetOrdersByCriteria(OrderSearchType searchType, int customerId)
        {
            IQueryable<Order> orders = null;

            switch (searchType)
            {
                case OrderSearchType.None:
                    orders = rep.GetAll();
                    break;
                case OrderSearchType.ByCustomer:
                    orders = rep.GetAll().Where(cu => cu.Customer.CustomerId == customerId);
                    break;
            }

            return orders;
        }
        public IQueryable <Order> GetOrdersByCriteria(OrderSearchType searchType, int customerId)
        {
            IQueryable <Order> orders = null;

            switch (searchType)
            {
            case OrderSearchType.None:
                orders = rep.GetAll();
                break;

            case OrderSearchType.ByCustomer:
                orders = rep.GetAll().Where(cu => cu.Customer.CustomerId == customerId);
                break;
            }

            return(orders);
        }
Esempio n. 3
0
 private IList <OrderListDTO> getOrders(OrderSearchType searchType, int customerid)
 {
     try
     {
         GetOrdersRequest request = new GetOrdersRequest();
         request.SearchType = searchType;
         request.CustomerId = customerid;
         GetOrdersResponse response = Service.GetOrdersByCriteria(request);
         return(response.Orders);
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, "PL Policy"))
         {
             throw;
         }
         return(new List <OrderListDTO>());
     }
 }
Esempio n. 4
0
 private IList<OrderListDTO> getOrders(OrderSearchType searchType, int customerid)
 {
     try
     {
         GetOrdersRequest request = new GetOrdersRequest();
         request.SearchType = searchType;
         request.CustomerId = customerid;
         GetOrdersResponse response = Service.GetOrdersByCriteria(request);
         return response.Orders;
     }
     catch (Exception ex)
     {
         if (ExceptionPolicy.HandleException(ex, "PL Policy")) throw;
         return new List<OrderListDTO>();
     }
 }