Example #1
0
        // GET: Orders/Edit/5
        public ActionResult Details(Guid?id, bool showHistory)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            OrderEditView order = OrderEditHelpers.GetOrderEditView(db, id.Value, User);

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

            ViewBag.ShowHistory = showHistory;

            return(View(order));
        }
Example #2
0
        public ActionResult Details(OrderEditView order)
        {
            if (ModelState.IsValid)
            {
                if (Request.Form["despatchedbutton"] != null)
                {
                    //Update tables
                    OrderHelpers.ChangeOrderStatus(db, order.OrderId, OrderStatusEnum.Despatched, User);
                    return(RedirectToAction("Orders", "ManageListings"));
                }
                if (Request.Form["delivereddbutton"] != null)
                {
                    //Update tables
                    OrderHelpers.ChangeOrderStatus(db, order.OrderId, OrderStatusEnum.Delivered, User);
                    return(RedirectToAction("Orders", "ManageListings"));
                }
                if (Request.Form["collectedbutton"] != null)
                {
                    //Update tables
                    OrderHelpers.ChangeOrderStatus(db, order.OrderId, OrderStatusEnum.Collected, User);
                    return(RedirectToAction("Orders", "ManageListings"));
                }
                if (Request.Form["receivedbutton"] != null)
                {
                    //Update tables
                    OrderHelpers.ChangeOrderStatus(db, order.OrderId, OrderStatusEnum.Received, User);
                    return(RedirectToAction("Orders", "ManageListings"));
                }
                if (Request.Form["closedbutton"] != null)
                {
                    //Update tables
                    OrderHelpers.ChangeOrderStatus(db, order.OrderId, OrderStatusEnum.Closed, User);
                    return(RedirectToAction("Orders", "ManageListings"));
                }
            }

            order = OrderEditHelpers.GetOrderEditView(db, order.OrderId, User);

            ViewBag.ShowHistory = false;

            return(View(order));
        }