I have User class:
public class User : Entity
{
public void AcceptMenu(Menu menu)
{
//AcceptMenu
}
public string Login { get; set; }
public string Password { get; set; }
public string Salt { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
}
And I create authorization logic. Authenticate method looks like this:
private async Task Authenticate(User user)
{
var claims = new List<Claim>
{
new Claim(ClaimsIdentity.DefaultNameClaimType, user.Login),
new Claim(ClaimsIdentity.DefaultRoleClaimType, user.Role)
};
ClaimsIdentity id = new ClaimsIdentity(claims, "ApplicationCookie", ClaimsIdentity.DefaultNameClaimType, ClaimsIdentity.DefaultRoleClaimType);
await HttpContext.SignInAsync(CookieAuthenticationDefaults.AuthenticationScheme, new ClaimsPrincipal(id));
}
As you can see I have AcceptMenu method in User. How can I get User in Controller and execute AcceptMenu method?