Пример #1
0
        public ActionResult Login(LoginViewModel loginData)
        {
            if (ModelState.IsValid)
            {
                Member m = MemberDB.FindMember(loginData.Username, loginData.Password);
                if (m == null)
                {
                    ModelState.AddModelError("InvalidCredentials", "No Account with those credentials was found");
                    return(View(loginData));
                }

                //log them in
                SessionHelper.LogUserIn(m);
                //redirect to index page
                return(RedirectToAction("Index", "Home"));
            }

            return(View(loginData));
        }