0
I’m using the Identity with aspnet core 2.0 and I needed to add the attribute nuCPF on the table Applicationuser. In the controller I am getting the user data as follows:
[Controller: Clientecontroller]
public ClienteController(UserManager<ApplicationUser> userManager)
{
_userManager = userManager;
}
[HttpGet]
public ActionResult Index(int paginaAtual = 1, string filtro = "")
{
var NomeUsuarioLogado = User.Identity.Name;
var idUsuarioLogado = _userManager.GetUserId(HttpContext.User);
xxxxx.... etc
}
The class Applicationuser is like this:
public class ApplicationUser
{
public int Id { get; set; }
public string UserName { get; set; }
public string NormalizedUserName { get; set; }
public string Email { get; set; }
public string NormalizedEmail { get; set; }
public bool EmailConfirmed { get; set; }
public string PasswordHash { get; set; }
public string PhoneNumber { get; set; }
public bool PhoneNumberConfirmed { get; set; }
public bool TwoFactorEnabled { get; set; }
public string nuCPF { get; set; }
}
Doubt 1:
How could I take the value of the field nuCPF?
Doubt 2:
When I use the '_userManager.Getuserid(user)', a select is made in the database to get the user id?
Fabri, it seems to me that there is no "Getuser" method in userManager. see how it is for me: https://prnt.sc/irn5jh ?
– Mecias Bueno
Getuserasync, use this one
– Fabri Damazio
You do not find the nuCPF property when using "user.Nucpf" , the following error appears: does not contain a definition for "nuCPF" and could not find any "nuCPF" extension method that accepts a first argument of type "Task<Applicationuser>"
– Mecias Bueno
Send the current code to see how this
– Fabri Damazio
'public ClienteController(UserManager<ApplicationUser> userManager, ILogger<AccountController> logger)
 {
 _logger = logger;

 var user = userManager.GetUserAsync(User);
 var teste = user.nuCPF;
 }' the Applicationuser is just like the question in the main post.
– Mecias Bueno