Change password Student

1

In the student environment, it should change your password.

I created the code below but I can not get results in the database. Does anyone notice anything 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();
}
    
asked by anonymous 14.05.2014 / 20:13

1 answer

1

It seems like you're trying to save alunoNovaSenha without changing your password.

Considering that the correct password is in aluno , the code below should solve the problem:

alunoNovaSenha.Senha = aluno.Senha;
bdAluno.Salvar(alunoNovaSenha);
    
14.05.2014 / 20:23