public ActionResult Create(OrderViewModel model) { if (ModelState.IsValid) { OrdersBinderHelper.AddOrder(model); } return(PartialView("_OrderCreate", model)); }
public HomeController() : base() { try { IEnumerable <OrderViewModel> testResult = OrdersBinderHelper.RetrunListOfOrders(); } catch (Exception) { OrdersBinderHelper.WriteListOfOrders(new List <OrderViewModel>() { new OrderViewModel() { ContactName = "Charles", CustomerID = "1", OrderDate = DateTime.Now.AddDays(-1), OrderID = 1, ShippedDate = DateTime.Now }, new OrderViewModel() { ContactName = "John", CustomerID = "2", OrderDate = DateTime.Now.AddDays(-2), OrderID = 2, ShippedDate = DateTime.Now }, }); } }
// GET: OrdersData public ActionResult GetOrders([DataSourceRequest] DataSourceRequest request) { var result = OrdersBinderHelper.RetrunListOfOrders(); return(Json(result.ToDataSourceResult(request), JsonRequestBehavior.AllowGet)); }