I created an AspNet MVC project with Identity to understand how the Identity part works. I made changes to the code, including roles and claims. I migrated this project to a company project, but the project is all done in layers (MVC, Business, Repository, DAL). The problem now is that I can not pass data to the business layer - repository - DAL. When I debug the code in the Login method, my SignInManager method always returns "Null". Can someone help me ? I'm new to the area and I can not solve the problem.
//
// POST: /Account/Login
[HttpPost]
[AllowAnonymous]
[ValidateAntiForgeryToken]
public async Task<ActionResult> Login(LoginViewModel model, string returnUrl)
{
if (!ModelState.IsValid)
{
return View(model);
}
var result = await SignInManager.PasswordSignInAsync(model.UserName, model.Password, model.RememberMe, shouldLockout: true);
switch (result)
{
case SignInStatus.Success:
var user = await UserManager.FindAsync(model.UserName, model.Password);
await SignInAsync(user, model.RememberMe);
return RedirectToLocal(returnUrl);
case SignInStatus.LockedOut:
return View("Lockout");
case SignInStatus.RequiresVerification:
return RedirectToAction("SendCode", new { ReturnUrl = returnUrl });
case SignInStatus.Failure:
default:
ModelState.AddModelError("", "Login ou Senha incorretos.");
return View(model);
}
}