public virtual void Update(T entity) { dbset.Attach(entity); dataContext.Entry(entity).State = EntityState.Modified; //.Entry : l'objet a ajouter a modier a supprimer // modifier l'objer et fais la mise a jour sur tout les propriété (exemple ou on a 100 propriété . donc //on peur pas les modier propriété par propriété }
public ActionResult Edit([Bind(Include = "ID,Prenom,Nom,DateNaissance,Address")] Personne personne) { if (ModelState.IsValid) { db.Entry(personne).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(personne)); }
public ActionResult Edit([Bind(Include = "CategoryId,Name,CategoryDescription")] Category category) { if (ModelState.IsValid) { db.Entry(category).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(category)); }
public ActionResult Edit([Bind(Include="ProductId,DateProd,Description,Name,Price,Quantity,CategoryId")] Product product) { if (ModelState.IsValid) { db.Entry(product).State = EntityState.Modified; db.SaveChanges(); return RedirectToAction("Index"); } ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "Name", product.CategoryId); return View(product); }
public ActionResult Edit([Bind(Include = "Id,Name,Description,Price,Image,CategoryId")] Book book, HttpPostedFileBase upload, HttpPostedFileBase vid) { if (ModelState.IsValid) { String path = Path.Combine(Server.MapPath("~/Uploads"), upload.FileName); String path2 = Path.Combine(Server.MapPath("~/Uploads"), vid.FileName); vid.SaveAs(path2); upload.SaveAs(path); //enregistrer path dans la BD book.Fichier = vid.FileName; book.Image = upload.FileName; db.Entry(book).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(db.Categories, "CategoryId", "Name", book.CategoryId); return(View(book)); }
public virtual void Update(T entity) { dbset.Attach(entity); dataContext.Entry(entity).State = EntityState.Modified; }
public void Update(T t) { dbset.Attach(t); _ctx.Entry(t).State = EntityState.Modified; }
public void Update(Category c) { ctx.Entry(c).State = EntityState.Modified; ctx.SaveChanges(); }
public void Update(User u) { ctx.Entry(u).State = EntityState.Modified; ctx.SaveChanges(); }
public void Update(Book b) { ctx.Entry(b).State = EntityState.Modified; ctx.SaveChanges(); }