Example #1
0
        public ActionResult LogIn(LoginModel m)
        {
            if (m.Email == null || m.Password == null)
            {
                ViewBag.LogInError = "Username or password incorrect. Try again.";
                return(View("Index", m));
            }


            grabFromDB DB = new grabFromDB();

            List <User> list = DB.getUsers(m.Email, m.Password);

            if (list.Count == 0)
            {
                ViewBag.LogInError = "Username or password incorrect. Try again.";
                return(View("Index", m));
            }
            else
            {
                Globals.setCurrentUser(m.Email);
                return(RedirectToAction("FrontPage", "Home"));
            }
        }