public ActionResult Confirmation() { int ID = Convert.ToInt32(RouteData.Values["ID"]); Models.CUser User = new Models.CUser(); Models.COrder order = new Models.COrder(); Models.CDatabase db = new Models.CDatabase(); List <Models.CProduct> productList = new List <Models.CProduct>(); User = User.GetCurrentUser(); order = Models.COrder.GetOrder(0, User.UserID, 1); productList = db.GetCart(User.UserID); // Update Order Information order.intStatusID = 2; db.UpdateOrder(order); // Update Product Stock amount foreach (Models.CProduct product in productList) { product.intStockAmount = product.intStockAmount - 1; db.UpdateProduct(product); } return(View(User)); }
public ActionResult Addresses(FormCollection Collection) { try { Models.CUser User = new Models.CUser(); Models.CDatabase db = new Models.CDatabase(); Models.CAddress EnteredAddress = new Models.CAddress(); Models.COrder order = new Models.COrder(); Models.CUser user = new Models.CUser(); int intAddressID; EnteredAddress.strAddress = Collection["strAddress"]; EnteredAddress.strCity = Collection["strCity"]; EnteredAddress.intStateID = Convert.ToInt32(Collection["intStateID"]); EnteredAddress.strZipCode = Collection["strZipCode"]; intAddressID = EnteredAddress.DoesAddressExist(EnteredAddress); user = user.GetCurrentUser(); order = Models.COrder.GetOrder(0, user.UserID, 1); if (intAddressID > 0) { order.intShippingAddressID = intAddressID; db.UpdateOrder(order); } else { intAddressID = db.InsertAddress(EnteredAddress); order.intShippingAddressID = intAddressID; db.UpdateOrder(order); } return(RedirectToAction("Payment")); } catch (Exception ex) { throw new Exception(ex.Message); } }