Ejemplo n.º 1
0
        // GET: Admin/OrderEntries
        public ActionResult Index()
        {
            var orders = db.Orders.ToList().OrderByDescending(x => x.Date).ToList();

            OrdersViewModel ovm = CustomerOrderMappers.OrdersToViewModel(orders);

            return(View(ovm));
        }
Ejemplo n.º 2
0
        public ActionResult GetOrders(string id)
        {
            StoreContext db = new StoreContext();

            var orderList = db.Orders.Where(x => x.UserID == id).ToList();

            OrdersViewModel toView = new OrdersViewModel();

            foreach (var order in orderList)
            {
                toView.OrdersList.Add(CustomerOrderMappers.OrderToViewModel(order));
            }

            return(View(toView));
        }
Ejemplo n.º 3
0
        public ActionResult Details(string id)
        {
            StoreContext db = new StoreContext();

            var order = db.Orders.SingleOrDefault(x => x.OrderId == id);

            if (order == null)
            {
                return(HttpNotFound());
            }

            OrderViewModel ovm = CustomerOrderMappers.OrderToViewModel(order);


            return(View(ovm));
        }
Ejemplo n.º 4
0
        // GET: Admin/OrderEntries/Details/5
        public ActionResult Details(string id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Order          order = db.Orders.FirstOrDefault(x => x.OrderId == id);
            OrderViewModel ovm   = CustomerOrderMappers.OrderToViewModel(order);


            if (ovm.Items == null)
            {
                return(HttpNotFound());
            }

            ViewBag.OrderId = id;

            return(View(ovm));
        }
Ejemplo n.º 5
0
        public ActionResult Filter(string id)
        {
            Enum.TryParse(id, out OrderStatus status);
            List <Order> toView = new List <Order>();

            var allOrders = db.Orders.ToList();

            foreach (var order in allOrders)
            {
                if (order.Status == status)
                {
                    toView.Add(order);
                }
            }

            OrdersViewModel ovm = CustomerOrderMappers.OrdersToViewModel(toView);


            return(View("Index", ovm));
        }