コード例 #1
0
        public ActionResult DeleteConfirmed(int id)
        {
            Orther orther = db.Orthers.Find(id);

            db.Orthers.Remove(orther);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "OrtherID,CustomerID,DateOrdered,DateRicived,ShippingMethod,PaymentMethod,PaymentType,Status,Amout")] Orther orther)
 {
     if (ModelState.IsValid)
     {
         db.Entry(orther).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CustomerID    = new SelectList(db.Customers, "CustomerID", "Name", orther.CustomerID);
     ViewBag.PaymentMethod = new SelectList(db.PaymenMethods, "PaymenMethodsID", "Name", orther.PaymentMethod);
     return(View(orther));
 }
コード例 #3
0
        // GET: Admin/Orthers/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Orther orther = db.Orthers.Find(id);

            if (orther == null)
            {
                return(HttpNotFound());
            }
            return(View(orther));
        }
コード例 #4
0
        // GET: Admin/Orthers/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Orther orther = db.Orthers.Find(id);

            if (orther == null)
            {
                return(HttpNotFound());
            }
            ViewBag.CustomerID    = new SelectList(db.Customers, "CustomerID", "Name", orther.CustomerID);
            ViewBag.PaymentMethod = new SelectList(db.PaymenMethods, "PaymenMethodsID", "Name", orther.PaymentMethod);
            return(View(orther));
        }
コード例 #5
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"));
        }