1
In the student environment, they must change their password.
I created the code below but can’t get results in the bank. Someone notices something wrong?
[HttpPost]
public ActionResult AlterarSenha(CONSUL_CA_Aluno aluno)
{
    string cpf = System.Web.HttpContext.Current.User.Identity.Name;
    var bdAluno = CONSUL_CA_AlunoAplicacaoConstrutor.CONSUL_CA_AlunoAplicacaoEF();
    var alunoNovaSenha = bdAluno.ListarTodos().Where(x => x.Cpf == cpf).First();
    ViewData["aluno"] = aluno;
    ViewBag.Senha = aluno.Senha;
    bdAluno.Salvar(alunoNovaSenha);
    return View();
}
I think the first line can be reduced to
string cpf = Page.User.Identity.Name(or justUser.Identity.Name... I’m a little rusty).– Oralista de Sistemas
Another thing... If the query does not bring results, there is a possibility that the
CONSUL_CA_AlunoAplicacaoEF, or the methodListarTodos, is empty. We would need to see the code of these methods.– Oralista de Sistemas