예제 #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;
 }