Пример #1
0
        public async Task <IActionResult> Index()
        {
            if (HttpContext.User.Identity.IsAuthenticated)
            {
                string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
                HttpContext.Session.SetInt32("userLogged", int.Parse(userId));

                string tipoUser = await repo.ExisteTipoUsuario(int.Parse(userId));

                if (tipoUser.Equals("Paciente"))
                {
                    DateTime fecha = DateTime.Now;
                    await repo.CheckCitasCaducadas(int.Parse(userId), fecha);
                }
            }
            return(View());
        }
Пример #2
0
        // GET: Paciente
        public async Task <IActionResult> Index()
        {
            if (HttpContext.Session.GetInt32("userLogged") == null)
            {
                return(RedirectToAction("Login", "Manage"));
            }
            int    userLogged = int.Parse(HttpContext.Session.GetInt32("userLogged").ToString());
            string tipoUser   = await repo.ExisteTipoUsuario(userLogged);

            if (tipoUser.Equals("Personal"))
            {
                return(RedirectToAction("VerCitas", "Personal", new { userLogged = userLogged }));
            }
            DateTime fecha = DateTime.Now;
            await repo.CheckCitasCaducadas(userLogged, fecha);

            return(View());
        }
 public string CheckCitasCaducadas(int userLogged, DateTime fecha)
 {
     return(repo.CheckCitasCaducadas(userLogged, fecha));
 }