Пример #1
0
        public async Task <IActionResult> Login(LoginUser login)
        {
            var db   = new SimpleTodoDbContext();
            var user = db.Users
                       .Where(u => u.LoginName == login.Name && u.Password == login.Password)
                       .FirstOrDefault();

            if (user != null)
            {
                var claims = new List <Claim>
                {
                    new Claim(ClaimTypes.Name, user.LoginName)
                };

                var claimsIdentity = new ClaimsIdentity(
                    claims,
                    CookieAuthenticationDefaults.AuthenticationScheme);

                await HttpContext.SignInAsync(
                    CookieAuthenticationDefaults.AuthenticationScheme,
                    new ClaimsPrincipal(claimsIdentity));

                //return Redirect("/Lists");
                return(Redirect("/Lists/Start")); //old prj not nav bar
            }
            return(View());
        }
Пример #2
0
 public TodoTasksController(SimpleTodoDbContext context)
 {
     _context = context;
 }
Пример #3
0
 public ListsController(SimpleTodoDbContext context)
 {
     _context = context;
 }
Пример #4
0
 public UsersController(SimpleTodoDbContext context)
 {
     _context = context;
 }