public ActionResult ChangeOrderStatus(string orderId, string orderStatus) { if (orderId != null && orderStatus != null) { switch (orderStatus) { case "Despatched": OrderHelpers.ChangeOrderStatus(GeneralHelpers.GetGuidFromStringId(orderId), OrderStatusEnum.Despatched, User); break; case "Delivered": OrderHelpers.ChangeOrderStatus(GeneralHelpers.GetGuidFromStringId(orderId), OrderStatusEnum.Delivered, User); break; case "Collected": OrderHelpers.ChangeOrderStatus(GeneralHelpers.GetGuidFromStringId(orderId), OrderStatusEnum.Collected, User); break; case "Received": OrderHelpers.ChangeOrderStatus(GeneralHelpers.GetGuidFromStringId(orderId), OrderStatusEnum.Received, User); break; case "Closed": OrderHelpers.ChangeOrderStatus(GeneralHelpers.GetGuidFromStringId(orderId), OrderStatusEnum.Closed, User); break; } return(Json(new { success = true })); } else { return(Json(new { success = false })); } }
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)); }