public async Task <IActionResult> Login(Person person) { var personlogin = await _personAppService.GetPersonByUserId(person.UserId); if (personlogin == null) { return(View("../Home/Login")); } else { var claims = new List <Claim> { new Claim("UserId", personlogin.UserId), }; var claimsIdentity = new ClaimsIdentity( claims, CookieAuthenticationDefaults.AuthenticationScheme); var authProperties = new AuthenticationProperties { }; await HttpContext.SignInAsync( CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(claimsIdentity), authProperties); return(View("../Home/Index")); } }
public async Task <ActionResult> SelectCourseCreate() { if (!HttpContext.User.Identity.IsAuthenticated) { return(View("../Home/Login")); } else { var personId = HttpContext.User.Claims.First().Value; var person = await _personAppService.GetPersonByUserId(personId); var courseList = await _courseAppService.GetCoursesList(); ViewData["person"] = person.Name; ViewData["personId"] = person.UserId; ViewData["courseList"] = courseList; return(View()); } }