1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
// GET: /Entree/Create
public ActionResult Create()
{
ViewBag.idMateriel = new SelectList(db.Materiels, "idMateriel", "nomMateriel");
return View();
}
//
// POST: /Entree/Create
[HttpPost]
public ActionResult Create(Entree entree)
{
if (ModelState.IsValid)
{
entree.dateEntree = DateTime.Now;
db.Entrees.AddObject(entree);
db.SaveChanges();
return RedirectToAction("Index");
}
ViewBag.idMateriel = new SelectList(db.Materiels, "idMateriel", "nomMateriel", entree.idMateriel);
return View(entree);
} |
Partager