public ActionResult DeleteConfirmed(int id) { Orther orther = db.Orthers.Find(id); db.Orthers.Remove(orther); db.SaveChanges(); return(RedirectToAction("Index")); }
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)); }
// 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)); }
// 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)); }
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")); }