public IActionResult Index()
        {
            List <Orders> orders = ManageCookies.GetOrdersFromCookies(Request.Cookies["orders"], _context);

            orders = orders.OrderByDescending(x => x.Created).ToList();

            orders = ManageOrderLines.Build(orders, _context);

            return(View(orders));
        }
示例#2
0
        public IActionResult Index()
        {
            List <Orders> orders = new List <Orders>();

            orders = _context.Orders.OrderByDescending(x => x.Created).ToList();

            orders = ManageOrderLines.Build(orders, _context);

            return(View(orders));
        }
示例#3
0
        public IActionResult Index(int id)
        {
            List <Orders> orders      = new List <Orders>();
            Orders        orderResult = _context.Orders.Find(id);

            if (orderResult != null)
            {
                orders.Add(_context.Orders.Find(id));
                orders = ManageOrderLines.Build(orders, _context);
            }

            return(View(orders));
        }
        public string GetOpenOrders()
        {
            List <Orders> openOrders = _context.OpenOrders.Where(x => x.Cancelled == null && x.Completed == null)
                                       .OrderBy(x => x.Created)
                                       .ToList();

            foreach (Orders order in openOrders)
            {
                order.Elapsed = (DateTime.Now - order.Created).Minutes;
            }

            ManageOrderLines.Build(openOrders, _context);
            return(JsonConvert.SerializeObject(openOrders));
        }
        public IActionResult Index()
        {
            List <Orders> orders = new List <Orders>();

            //TODO Investigate. OpenOrders doesn't seem to return view results
            //Brings back all results unless Linq filtered here.

            orders = _context.OpenOrders.Where(x => x.Cancelled == null && x.Completed == null)
                     .OrderBy(x => x.Created)
                     .ToList();


            orders = ManageOrderLines.Build(orders, _context);

            return(View(orders));
        }