예제 #1
0
        private void SearchByTotalPrice(ref IIncludableQueryable <Order, Address> orders, double?MinTotal, double?MaxTotal)
        {
            if (!orders.Any())
            {
                return;
            }

            if (MinTotal == null && MaxTotal != null)
            {
                orders = orders.Where(o => o.total <= MaxTotal).Include(o => o.Address);
            }
            else if (MinTotal != null && MaxTotal == null)
            {
                orders = orders.Where(o => o.total >= MinTotal).Include(o => o.Address);
            }
            else if (MinTotal != null && MaxTotal != null)
            {
                orders = orders.Where(o => o.total >= MinTotal && o.total <= MaxTotal)
                         .Include(o => o.Address);
            }
        }
예제 #2
0
        private void SearchByShippingPrice(ref IIncludableQueryable <Order, Address> orders, double?MinPrice, double?MaxPrice)
        {
            if (!orders.Any())
            {
                return;
            }

            if (MinPrice == null && MaxPrice != null)
            {
                orders = orders.Where(o => o.shipping <= MaxPrice).Include(o => o.Address);
            }
            else if (MinPrice != null && MaxPrice == null)
            {
                orders = orders.Where(o => o.shipping >= MinPrice).Include(o => o.Address);
            }
            else if (MinPrice != null && MaxPrice != null)
            {
                orders = orders.Where(o => o.shipping >= MinPrice && o.shipping <= MaxPrice)
                         .Include(o => o.Address);
            }
        }