Exemplo n.º 1
0
 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é
 }
Exemplo n.º 2
0
 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));
 }
Exemplo n.º 3
0
 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));
 }
Exemplo n.º 4
0
 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);
 }
Exemplo n.º 5
0
 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));
 }
Exemplo n.º 6
0
 public virtual void Update(T entity)
 {
     dbset.Attach(entity);
     dataContext.Entry(entity).State = EntityState.Modified;
 }
Exemplo n.º 7
0
 public void Update(T t)
 {
     dbset.Attach(t);
     _ctx.Entry(t).State = EntityState.Modified;
 }
Exemplo n.º 8
0
 public void Update(Category c)
 {
     ctx.Entry(c).State = EntityState.Modified;
     ctx.SaveChanges();
 }
Exemplo n.º 9
0
 public void Update(User u)
 {
     ctx.Entry(u).State = EntityState.Modified;
     ctx.SaveChanges();
 }
Exemplo n.º 10
0
 public void Update(Book b)
 {
     ctx.Entry(b).State = EntityState.Modified;
     ctx.SaveChanges();
 }