Esempio n. 1
0
        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));
        }
Esempio n. 2
0
 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));
 }
Esempio n. 3
0
 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));
 }
Esempio n. 4
0
 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);
 }