Пример #1
0
        public async Task <IActionResult> Index()
        {
            try
            {
                var token = _session.GetString("Token");
                if (Seguridad.validarUsuarioAdministrativo(token))
                {
                    var items = await _controladoraUsuarios.getClientes();

                    return(View(items));
                }
                else
                {
                    return(RedirectToAction("Login", "Account"));
                }
            }
            catch (MensajeException msg)
            {
                TempData["Error"] = msg.Message;
                return(RedirectToAction("Index", "Home"));
            }
            catch (Exception)
            {
                TempData["Error"] = "Se produjo un error inesperado. Intente de nuevo mas tarde";
                return(RedirectToAction("Index", "Home"));
            }
        }