public ActionResult Edit([Bind(Include = "ID,Name,Active")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit([Bind(Include = "ID,Name,Description,UnitPrice,Active,CategoryID")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "ID", "Name", product.CategoryID); return(View(product)); }
public ActionResult Edit([Bind(Include = "ID,ProductID,PicURL")] ProductImage productImage) { if (ModelState.IsValid) { db.Entry(productImage).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProductID = new SelectList(db.Products, "ID", "Name", productImage.ProductID); return(View(productImage)); }
public ActionResult Edit([Bind(Include = "ID,ProductID,Size,UnitPrice,Active")] ProductSku productSku) { if (ModelState.IsValid) { db.Entry(productSku).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ProductID = new SelectList(db.Products, "ID", "Name", productSku.ProductID); return(View(productSku)); }
public ActionResult Edit([Bind(Include = "ID,OrderID,ProductID,Quantity,UnitPrice")] OrderDetail orderDetail) { if (ModelState.IsValid) { db.Entry(orderDetail).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.OrderID = new SelectList(db.Orders, "ID", "CustomerID", orderDetail.OrderID); ViewBag.ProductID = new SelectList(db.Products, "ID", "Name", orderDetail.ProductSkuID); return(View(orderDetail)); }
public virtual int Update(TObject TObject) { var entry = shoematicContext.Entry(TObject); DbSet.Attach(TObject); entry.State = EntityState.Modified; if (!shareContext) { return(shoematicContext.SaveChanges()); } return(0); }
// GET: Orders/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } Order order = db.Orders.Find(id); if (order == null) { return(HttpNotFound()); } order.Status = Utils.ConstantManager.ORDER_STATUS_CONFIRMED; db.Entry(order).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); }