public ActionResult Create(Orders orders) { if (ModelState.IsValid) { _orders.Add(orders); return(RedirectToAction("Index")); } return(View()); }
public JsonResult AddOrder(OrderValidation order) { if (ModelState.IsValid) { using (OrdersData db = new OrdersData()) { return(Json(db.Add(order))); } } return(Json(false)); }
/// <summary> /// Verify The Payment And Add The Order To The DataBase /// </summary> /// <param name="session"></param> /// <param name="creditCard"></param> /// <returns></returns> public static bool SetOrderToDatabase(this HttpSessionStateBase session, int creditCard) { if (creditCard != null && session["order"] != null) // check credit card { using (OrdersData db = new OrdersData()) { Order order = (Order)session["order"]; db.Add(order); session.Remove("order"); return(true); } } return(false); }