コード例 #1
0
        public ActionResult MyRegister(Customer customer)
        {
            if (ModelState.IsValid)
            {
                using (ShoppingCartEntities db = new ShoppingCartEntities())
                {
                    db.Customers.Add(customer);
                    db.SaveChanges();

                }
            }

            return RedirectToAction("Index");
        }
コード例 #2
0
        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");
        }