Esempio n. 1
0
        public ActionResult Login_in(User_Table u)
        {
            if (u == null) return RedirectToAction("LoginFail", "Account");
            using (var db = new DatabaeEntities())
            {
                var data = (from a in db.User_Table
                            where u.password.Equals(a.password) && u.Email.Equals(a.Email)
                            select a).ToList();
               if (data == null){
                   ViewBag.Error = "Sai mật khẩu hoặc email";
                   return RedirectToAction("LoginFail", "Account");
               }
               else
               {
                   return RedirectToAction("Index", "HomePage");
               }

            }
        }
Esempio n. 2
0
        public ActionResult submit(User_Table u)
        {
            using (DatabaeEntities db = new DatabaeEntities())
            {
                var data = (from a in db.User_Table
                            where u.password.Equals(a.password) && u.Email.Equals(a.Email)
                            select a).ToList();
               if (data.Count == 0){
                   return RedirectToAction("LoginF", "User");
               }
               else
               {

                   Session["kk"] = data.First().username;
                   Session["level"] = data.First().level;
                   return RedirectToAction("Index", "HomePage");
               }

            }
        }