コード例 #1
0
ファイル: IngredientsController.cs プロジェクト: rezke/PI
 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));
 }
コード例 #2
0
ファイル: ProductsController.cs プロジェクト: rezke/PI
 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));
 }
コード例 #3
0
ファイル: RepositoryBase.cs プロジェクト: FADIcheikh/Confs
 public virtual void Update(T entity)
 {
     dbset.Attach(entity);
     dataContext.Entry(entity).State = EntityState.Modified;
 }