Exemple #1
0
        public IHttpActionResult PutShopKeeper(int id, ShopKeeper shopKeeper)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != shopKeeper.ID)
            {
                return(BadRequest());
            }

            db.Entry(shopKeeper).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ShopKeeperExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Exemple #2
0
 public ActionResult Edit([Bind(Include = "ID,BrandName")] Brand brand)
 {
     if (ModelState.IsValid)
     {
         db.Entry(brand).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(brand));
 }
 public ActionResult Edit([Bind(Include = "ID,Name,BrandID")] Product product)
 {
     if (ModelState.IsValid)
     {
         db.Entry(product).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.BrandID = new SelectList(db.Brands, "ID", "BrandName", product.BrandID);
     return(View(product));
 }