public ActionResult Orders(OrderManageViewModel model) { if (ModelState.IsValid) { if (Request.Form["saveinbutton"] != null || Request.Form["saveoutbutton"] != null) { //Update orders OrderHelpers.UpdateOrders(db, model, User); } return(RedirectToAction("Orders", "ManageInfo")); } //rebuild the blank models as these have no entries anyway if (model.OrdersInViewModel == null) { model.OrdersInViewModel = new List <OrderInViewModel>(); } if (model.OrdersOutViewModel == null) { model.OrdersOutViewModel = new List <OrderOutViewModel>(); } return(View(model)); }