public async Task <IActionResult> Login(LoginVM model)
        {
            if (ModelState.IsValid)
            {
                LoginDBO loginModel = await db.Users.FirstOrDefaultAsync(u => u.Log == model.Log && u.Pass == model.Pass);

                if (loginModel != null)
                {
                    await Authenticate(model.Log); // аутентификация

                    return(Redirect("/admin/DashBoard/Products"));
                }
                else
                {
                    TempData["SM"] = "Некорректные логин и(или) пароль";
                    return(View(model));
                }
            }
            else
            {
                return(View(model));
            }
        }
示例#2
0
 public LoginVM(LoginDBO row)
 {
     Id   = row.Id;
     Log  = row.Log;
     Pass = row.Pass;
 }