Beispiel #1
0
        public ActionResult Login(Utilisateur objUser)
        {
            if (ModelState.IsValid)
            {
                using (BookingBusEntities db = new BookingBusEntities())
                {
                    var obj = db.Utilisateurs.Where(a => a.mail.Equals(objUser.mail) && a.mdp.Equals(objUser.mdp)).FirstOrDefault();
                    if (obj != null)
                    {
                        Session["UserID"]    = obj.id_utilisateur.ToString();
                        Session["UserName"]  = obj.nom_complet.ToString();
                        Session["mail"]      = obj.mail.ToString();
                        Session["telephone"] = obj.telephone.ToString();
                        Session["role"]      = obj.role.ToString();
                        if (obj.image != null)
                        {
                            Session["img"] = obj.image.ToString();
                        }
                        else
                        {
                            Session["img"] = "default.jpg";
                        }

                        //Session["user"] = objUser;
                        return(RedirectToAction("UserDashBoard"));
                    }
                }
            }
            return(View(objUser));
        }