public async Task <IActionResult> Auth(string cpfcnpj, string senha) { if (string.IsNullOrEmpty(cpfcnpj) && string.IsNullOrEmpty(senha)) { return(RedirectToAction("Error", "Home")); } var usu = _pacienteRepository.Autenticar(cpfcnpj, senha); if (usu != null) { if (usu.CodPerfil == 1) //Paciente { HttpContext.Session.SetString("cpf", cpfcnpj); return(RedirectToAction("Agenda", "Pacientes", new { cpf = cpfcnpj })); } else { HttpContext.Session.SetString("cpf", cpfcnpj); return(RedirectToAction("Agenda", "Terapeuta", new { cpf = cpfcnpj })); } } else { return(View("Error")); } }