public ActionResult Edit([Bind(Include = "IngredientId,Name,Unit")] Ingredient ingredient) { if (ModelState.IsValid) { db.Entry(ingredient).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(ingredient)); }
public ActionResult Edit([Bind(Include = "ProductId,Name,Price")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(product)); }
public virtual void Update(T entity) { dbset.Attach(entity); dataContext.Entry(entity).State = EntityState.Modified; }