Ejemplo n.º 1
0
        public async Task <IActionResult> SearchOrders(OrderSearchView model)
        {
            IQueryable <Order> orders = db.Order.Include(a => a.Address).Include(u => u.User);

            if (model.filters.OrderId != 0 && model.filters.OrderId != null)
            {
                orders = orders.Where(x => x.OrderId == model.filters.OrderId);
            }
            if (model.filters.Phone != null)
            {
                orders = orders.Where(x => x.User.Login == model.filters.Phone);
            }
            if (model.filters.Email != null)
            {
                orders = orders.Where(x => x.User.Email == model.filters.Email);
            }
            if (model.filters.Date != null)
            {
                orders = orders.Where(x => x.OrderDate.ToShortDateString() == model.filters.Date);
            }
            if (model.filters.Status != 0)
            {
                orders = orders.Where(x => x.Status == model.filters.Status);
            }
            if (model.filters.Delivery != "0")
            {
                orders = orders.Where(x => x.Delivery == model.filters.Delivery);
            }
            model.Orders = await orders.ToListAsync();

            return(View("~/Views/Admin/OrderManagement/OrderManagement.cshtml", model));
        }
Ejemplo n.º 2
0
        private void ShowOrder(object sender, EventArgs e)
        {
            OrderSearchView view = new OrderSearchView
            {
                Owner = _View.Form
            };

            view.Show();
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> SearchOrders(int?UserId)
        {
            List <Order> orders = new List <Order>();

            if (UserId != null)
            {
                orders = await db.Order.Include(a => a.Address).Include(u => u.User).Where(x => x.UserId == UserId).ToListAsync();
            }
            else
            {
                orders = await db.Order.Include(a => a.Address).Include(u => u.User).ToListAsync();
            }
            OrderSearchView model = new OrderSearchView
            {
                Orders  = orders,
                filters = new OrderFilters
                {
                    SelectFilter = "0"
                }
            };

            return(View("~/Views/Admin/OrderManagement/OrderManagement.cshtml", model));
        }