コード例 #1
0
        public async Task <IActionResult> Login(LoginViewModel login)
        {
            if (ModelState.IsValid)
            {
                Account acc = await AccountDb.DoesUserMatch(login, _context);

                if (acc != null)
                {
                    SessionHelper.CreateUserSession(_http, acc.AccountID, acc.Username);
                    return(RedirectToAction("Index", "Home"));
                }
                else
                {
                    ModelState.AddModelError(string.Empty, "Invalid Credintials");
                }
            }
            return(View(login));
        }