// // GET: /PendingOrder/orders public ActionResult Orders() { var result = dc.Orders.Where(x => x.OrderStatus == "Pending").ToList(); List <PendingOrderVM> OrderList = new List <PendingOrderVM>(); if (result != null) { foreach (var v in result) { PendingOrderVM POrders = new PendingOrderVM(); POrders.OrderId = v.OrderId; DateTime OrderDate = (DateTime)v.OrderDate; string date = OrderDate.ToString("MM/dd/yyyy"); POrders.OrderDate = date; POrders.TotalAmount = v.TotalAmount; POrders.OrderStatus = v.OrderStatus; POrders.Payment = v.Payment; OrderList.Add(POrders); } return(View(OrderList)); } return(View(ViewBag.ErrorMessage)); }
public JsonResult GetPendingOrders() { var result = dc.Orders.Where(x => x.OrderStatus == "Pending").ToList(); List <PendingOrderVM> Pending = new List <PendingOrderVM>(); if (result != null) { foreach (var v in result) { PendingOrderVM POrders = new PendingOrderVM(); POrders.OrderId = v.OrderId; DateTime OrderDate = (DateTime)v.OrderDate; string date = OrderDate.ToString("MM/dd/yyyy"); POrders.OrderDate = date; POrders.TotalAmount = v.TotalAmount; POrders.OrderStatus = v.OrderStatus; POrders.Payment = v.Payment; Pending.Add(POrders); } return(Json(Pending, JsonRequestBehavior.AllowGet)); } return(Json(Pending, JsonRequestBehavior.AllowGet)); }