public ActionResult Modifier() { if (Session["id"] != null) { Commande comm = new Commande(); IEnumerable <Commande> commandes = null; try { comm.NuComm = Request["NuComm"]; comm.NuVendeur = Request["NuVendeur"]; comm.NuClient = Request["NuClient"]; comm.DateComm = Request["DateComm"]; comm.Fact = Request["Fact"]; CommandeDao.UpdateComm(comm); commandes = CommandeDao.GetCommandes(); return(View("Index", commandes)); } catch (MonException e) { return(HttpNotFound()); } } else { return(View("~/Views/Home/Connexion.cshtml")); } }
public ActionResult Supprimer() { if (Session["id"] != null) { try { String str = Request["NuComm"]; CommandeDao.DelComm(str); IEnumerable <Commande> commandes = CommandeDao.GetCommandes(); return(View("Index", commandes)); } catch (MonException e) { return(HttpNotFound()); } } else { return(View("~/Views/Home/Connexion.cshtml")); } }
// GET: Commande public ActionResult Index() { if (Session["id"] != null) { IEnumerable <Commande> commandes = null; try { commandes = CommandeDao.GetCommandes(); } catch (MonException e) { ModelState.AddModelError("Erreur", "Erreur lors de la récupération des commandes : " + e.Message); return(View("Error")); } return(View(commandes)); } else { return(View("~/Views/Home/Connexion.cshtml")); } }