public OrderWithFiltersForCountSpecification(OrderSpecParams orderParams)
     : base(x =>
            (string.IsNullOrEmpty(orderParams.Search) || x.BuyerEmail.ToLower().Contains(orderParams.Search)) &&
            (string.IsNullOrEmpty(orderParams.Status) || x.Status.ToString() == orderParams.Status)
            )
 {
 }
 public OrdersWithItemsAndOrderingSpecification(OrderSpecParams orderParams)
 {
     AddInclude(o => o.OrderItems);
     AddInclude(o => o.DeliveryMethod);
     AddOrderByDescending(o => o.OrderDate);
     ApplyPaging(orderParams.PageSize * (orderParams.PageIndex - 1), orderParams.PageSize);
 }
 public OrdersAllWithItemsAndOrderingSpecification(OrderSpecParams orderParams)
     : base(x =>
            (string.IsNullOrEmpty(orderParams.Search) || x.BuyerEmail.ToLower().Contains(orderParams.Search)) &&
            (string.IsNullOrEmpty(orderParams.Status) || x.Status.ToString() == orderParams.Status)
            )
 {
     //lấy dữ liệu eager
     AddInclude(o => o.OrderItems);
     AddInclude(o => o.DeliveryMethod);
     //sắp xếp
     AddOrderByDescending(o => o.OrderDate);
     ApplyPaging(orderParams.PageSize * (orderParams.PageIndex - 1), orderParams.PageSize);
     if (!string.IsNullOrEmpty(orderParams.Sort))
     {
         // switch (orderParams.Sort)
         // {
         //     case "priceAsc":
         //         AddOrderBy(p => p.Price);
         //         break;
         //     case "priceDesc":
         //         AddOrderByDescending(p => p.Price);
         //         break;
         //     default:
         //         AddOrderBy(x => x.Name);
         //         break;
         // }
     }
 }
 public OrdersWithItemsAndOrderingAdminSpecification(OrderSpecParams orderParams) : base(x =>
                                                                                         (string.IsNullOrEmpty(orderParams.Search) || x.ShipToAddress.FirstName.ToLower().Contains(orderParams.Search) || x.ShipToAddress.LastName.ToLower().Contains(orderParams.Search)) && (orderParams.status.ToString() == "None" || x.Status.Equals(orderParams.status)))
 {
     AddInclude(x => x.ShipToAddress);
     AddInclude(o => o.OrderItems);
     AddInclude(o => o.DeliveryMethod);
     AddOrderBy(x => x.OrderDate);
     ApplyPaging(orderParams.PageSize * (orderParams.PageIndex - 1), orderParams.PageSize);
 }
 public OrdersWithFiltersForCountSpecification(OrderSpecParams orderParams) : base(x =>
                                                                                   (string.IsNullOrEmpty(orderParams.Search) || x.ShipToAddress.FirstName.ToLower().Contains(orderParams.Search) || x.ShipToAddress.LastName.ToLower().Contains(orderParams.Search)) && (orderParams.status.ToString() == "None" || x.Status.Equals(orderParams.status)))
 {
 }
 public OrdersWithItemsAndDeliveryMethodCountSpecification(OrderSpecParams orderParams) : base(o => o.BuyerEmail == orderParams.Email)
 {
 }
 public OrdersForCountSpecification(OrderSpecParams orderParams) : base(x =>
                                                                        (string.IsNullOrEmpty(orderParams.Search) || x.BuyerEmail.ToLower().Contains
                                                                             (orderParams.Search)))
 {
 }