public ActionResult FormTraitement(Client clt) { projetMvcEntities dt = new projetMvcEntities(); var x = (from c in dt.Clients where c.login == clt.login && c.MotPasse == clt.MotPasse select c).SingleOrDefault(); if (x == null) { Session["style"] = "off"; ViewBag.Warning = "Votre Login et/ou mot de passe est incorrecte !"; ViewBag.style = "display: none;"; return(View("Index")); } else { if (x.login == "Admin" && x.MotPasse == "12345") { Session["IdClient"] = x.NumClient; Session["ClientName"] = clt.login; return(Redirect(Url.Action("Index", "Admin"))); } else { Session["IdClient"] = x.NumClient; Session["ClientName"] = clt.login; return(Redirect(Url.Action("Index", "Client"))); } } }
public ActionResult VoirPannier() { projetMvcEntities dt = new projetMvcEntities(); int numClient = Int32.Parse(Session["IdClient"].ToString()); int montantTotal = 0; List <MonPannier> malist = new List <MonPannier>(); var x = from c in dt.Articles join d in dt.Commandes on c.NumArticle equals d.NumArticle where d.NumClient == numClient select new { Designation = c.Designation, PrixU = c.PrixU, DateCmd = d.DateCmd, QteArticle = d.QteArticle, photo = c.photo }; if (x != null) { foreach (var item in x) { MonPannier pann = new MonPannier(); pann.DateCmd = item.DateCmd; pann.Designation = item.Designation; pann.photo = item.photo; pann.PrixU = item.PrixU; pann.QteArticle = item.QteArticle; montantTotal += Int32.Parse(item.PrixU) * Int32.Parse(item.QteArticle.ToString()); malist.Add(pann); } // ViewBag.MontantTotal = "Montant total en DH = " + montantTotal; } ViewBag.MontantTotal = "Montant total en DH = " + montantTotal; var model = malist; return(View(model)); }
public ActionResult Lancercommande() { projetMvcEntities dt = new projetMvcEntities(); // ViewBag.Listcateg = new SelectList(dt.Categories, "RefCat", "NomCat"); ViewBag.Listcateg = dt.Categories.ToList(); return(View()); }
public ActionResult Inscription(Client clt) { projetMvcEntities dt = new projetMvcEntities(); var x = (from c in dt.Clients where c.login == clt.login select c).SingleOrDefault(); if (Request.Form["submitform"] != null) { if (ModelState.IsValid) { dt.Clients.Add(clt); var test = dt.SaveChanges(); if (test != 0) { Session["style"] = "on"; return(JavaScript("window.location = '" + Url.Action("Index", "Login") + "'")); } else { ViewBag.logExist = "Erreur de base de donnée !"; return(PartialView("_Partial1")); } } else { return(PartialView("_Partial2")); } } else { if (x != null) { ViewBag.logExist = "ce login existe déjà !"; return(PartialView("_Partial1")); } else { ViewBag.logExist = ""; return(PartialView("_Partial1")); } } }