public async Task <IActionResult> Login(Admin model, string ReturnUrl) { string password = GeneralTool.getMD5(model.Password); Admin admin = adminRepo.GetBy(g => g.EmailAddress == model.EmailAddress && g.Password == password) ?? null; if (admin != null) { ClaimsIdentity claimsIdentity = new ClaimsIdentity(new List <Claim> { new Claim(ClaimTypes.Email, admin.EmailAddress), new Claim(ClaimTypes.PrimarySid, admin.ID.ToString()), new Claim(ClaimTypes.Name, admin.Name + " " + admin.Surname) }, "TemplateCore"); ClaimsPrincipal claimsPrincipal = new ClaimsPrincipal(claimsIdentity); await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, claimsPrincipal, new AuthenticationProperties() { IsPersistent = true }); if (!string.IsNullOrEmpty(ReturnUrl)) { return(Redirect(ReturnUrl)); } else { return(RedirectToAction("Index")); } } else { ViewBag.hata = "Geçersiz Kullanıcı Adı veya Şifre..."; return(View(model)); } }