public ActionResult Edit() { Models.dotnetEntities1 db = new Models.dotnetEntities1(); //Models.Produit p = db.Produit.SingleOrDefault(x => x.@ref == 1); //Models.ProduitViewModel pvm = new Models.ProduitViewModel(); ////pvm.@ref = p.@ref; //pvm.designation = p.designation; //pvm.description = p.description; //pvm.couleur = p.couleur; //pvm.prix = p.prix; //pvm.photo = p.photo; return(View(db.Produit.ToList())); }
public ActionResult Delete(int id) { using (Models.dotnetEntities1 db = new Models.dotnetEntities1()) { var v = db.Produit.Where(a => a.@ref == id).FirstOrDefault(); if (v != null) { return(View(v)); } else { return(HttpNotFound()); } } }
public ActionResult Add(Produit p) { try { using (dotnetEntities1 db = new Models.dotnetEntities1()) { db.Produit.Add(p); db.SaveChanges(); } return(RedirectToAction("_LayoutAdmin")); } catch { return(View()); } }