public ActionResult MyRegister(Customer customer) { if (ModelState.IsValid) { using (ShoppingCartEntities db = new ShoppingCartEntities()) { db.Customers.Add(customer); db.SaveChanges(); } } return RedirectToAction("Index"); }
public ActionResult AddToOrder() { var db = new ShoppingCartEntities(); if (GetCart() != null) { var orther = new Orther { Amout = GetCart().SubTotal(), DateOrdered=DateTime.Now, Status = "Chưa thanh toán" }; db.Orthers.Add(orther); db.SaveChanges(); Session.Abandon(); return RedirectToAction("Index"); } return RedirectToAction("Index"); }