public ActionResult addCart(int artid, int qte) { try { if (Session["person"] == null) { return(RedirectToAction("Index", "Login")); } Client cli = (Client)Session["person"]; s2.AjouteCommande(cli.numClient, artid, qte); ViewBag.num = s2.countCommandeClient(cli.numClient); ViewBag.charts = s2.getCommandeById(cli.numClient); ViewBag.totalcart = s2.totalClient(cli.numClient); // ici je dois ajoute hadak au favoris apres avoir cree f la bd return(RedirectToAction("Index", new { artid = artid })); } catch (Exception) { return(View("Error")); } }
public ActionResult AjouterPanier(FormCollection formx) { try { ViewBag.e = new SelectList(s3.getAllCategorie(), "refCat", "nomCat"); Client person = (Client)Session["person"]; var x = s2.getCommandeById(person.numClient); int contenu = Int32.Parse(formx["contenu"]); int qte = Int32.Parse(formx["qte"]); int stock = Int32.Parse(formx["stock"]); if (stock < qte) { ViewBag.err = "Stock insuffisant"; } else { s2.AjouteCommande(person.numClient, contenu, qte); } return(View(x)); } catch (Exception) { return(View("Error")); } }
public ActionResult AddToChart(int artid) { if (Session["person"] == null) { return(RedirectToAction("Index", "Login")); } Client cli = (Client)Session["person"]; s2.AjouteCommande(cli.numClient, artid, 1); ViewBag.num = s2.countCommandeClient(cli.numClient); ViewBag.charts = s2.getCommandeById(cli.numClient); ViewBag.totalcart = s2.totalClient(cli.numClient); return(RedirectToAction("Index")); }