public IHttpActionResult PutProducts_StoreProduct(int id, Products_StoreProduct products_StoreProduct) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != products_StoreProduct.Id) { return(BadRequest()); } db.Entry(products_StoreProduct).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!Products_StoreProductExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Edit([Bind(Include = "Id,Img,Stock,Name,Price,Section")] Products_StoreProduct products_StoreProduct) { if (ModelState.IsValid) { db.Entry(products_StoreProduct).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(products_StoreProduct)); }
public ActionResult Edit([Bind(Include = "ProductID,ProductName,SupplierID,CategoryID,QuantityPerUnit,UnitPrice,UnitsInStock,UnitsOnOrder,ReorderLevel,Discontinued")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryID = new SelectList(db.Categories, "CategoryID", "CategoryName", product.CategoryID); return(View(product)); }
public ActionResult Edit([Bind(Include = "ItemId,CategoryId,ProducerId,Title,Price,ItemArtUrl")] Item item) { if (ModelState.IsValid) { db.Entry(item).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "Name", item.CategoryId); ViewBag.ProducerId = new SelectList(db.Producers, "ProducerId", "Name", item.ProducerId); return View(item); }