//GET: PerfilUsuario
        public async Task <IActionResult> VerPerfil(int userLogged)
        {
            string token = HttpContext.Session.GetString("token");

            if (token == null)
            {
                TempData["Mensaje"] = "Sesion expirada,vuelva a hacer el log in por favor.";
                return(RedirectToAction("Login", "Manage"));
            }
            string existe = await repo.ExisteTipoUsuario(userLogged);

            Perfil_ViewModel perfil = new Perfil_ViewModel();

            if (existe.Equals("Paciente"))
            {
                Paciente paciente = await repo.FindPaciente(userLogged, token);

                perfil.Paciente = paciente;
                ViewBag.Edad    = await repo.EdadPaciente(paciente.Fecha_Nacimiento);

                return(View(perfil));
            }
            else if (existe.Equals("Personal"))
            {
                Personal personal = await repo.FindPersonal(userLogged, token);

                perfil.Personal = personal;
                ViewBag.Edad    = await repo.EdadPaciente(personal.Fecha_Nacimiento);

                return(View(perfil));
            }
            else
            {
                Usuarios user = await repo.FindUser(userLogged, token);

                TempData["User"] = JsonConvert.SerializeObject(user);
                if (user.NombreRole.Equals("Médico"))
                {
                    return(RedirectToAction("CrearPersonal", "Personal"));
                }
                else
                {
                    return(RedirectToAction("CrearPaciente", "Paciente"));
                }
            }
        }
        //GET: DetallesInforme
        public async Task <IActionResult> DetallesInforme(int informeId)
        {
            string token = HttpContext.Session.GetString("token");

            if (token == null)
            {
                TempData["Mensaje"] = "Sesion expirada,vuelva a hacer el log in por favor.";
                return(RedirectToAction("Login", "Manage"));
            }
            //Mostrar los detalles para el informe seleccionado.
            Informe informe = await repo.GetDetallesInforme(informeId, token);

            int edad = await repo.EdadPaciente(informe.Paciente.Fecha_Nacimiento);

            ViewBag.Edad = edad;

            return(View(informe));
        }
Beispiel #3
0
        //GET: DetallesPaciente
        public async Task <IActionResult> DetallesPaciente(int pacienteId)
        {
            string token = HttpContext.Session.GetString("token");

            if (token == null)
            {
                TempData["Mensaje"] = "Sesion expirada,vuelva a hacer el log in por favor.";
                return(RedirectToAction("Login", "Manage"));
            }
            Paciente paciente = await repo.FindPacienteById(pacienteId, token);

            ViewBag.Edad = await repo.EdadPaciente(paciente.Fecha_Nacimiento);

            return(View(paciente));
        }
Beispiel #4
0
 public ActionResult <int> EdadPaciente(DateTime fechaNacimiento)
 {
     return(repo.EdadPaciente(fechaNacimiento));
 }