public IHttpActionResult PutArticle(int id, Article article) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != article.id) { return(BadRequest()); } db.Entry(article).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ArticleExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public ActionResult Create([Bind(Include = "id,name,address")] Store store) { if (ModelState.IsValid) { db.Stores.Add(store); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(store)); }
public ActionResult Create([Bind(Include = "id,name,description,price,totalInShelf,totalInVault,storeId")] Article article) { if (ModelState.IsValid) { db.Articles.Add(article); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(article)); }