Exemplo n.º 1
0
        public IActionResult Index(string email, string senha)
        {
            var usuario = usuarioRepository.GetUsuario(email, senha);

            if (usuario != null)
            {
                httpContext.HttpContext.Session.SetInt32("UsuarioLogadoId", usuario.Id);
                httpContext.HttpContext.Session.SetString("UsuarioLogadoNome", usuario.Nome);
                if (usuario.Adm)
                {
                    return(View("../Home/Index", new IndexViewModel(tarefaRepository.GetTodasTarefas(), usuarioRepository.GetUsuarios())));
                }
                return(View("../Home/Usuario/Index", new IndexViewModel(tarefaRepository.GetTarefasPorUsuario(usuario), usuarioRepository.GetUsuarios())));
            }
            return(View("Error"));
        }
Exemplo n.º 2
0
 public IActionResult Index()
 {
     if (usuarioLogado == null)
     {
         return(RedirectToAction("Login", "Secure"));
     }
     if (usuarioLogado.Adm)
     {
         return(View("../Home/Index", new IndexViewModel(tarefaRepository.GetTodasTarefas(), usuarioRepository.GetUsuarios())));
     }
     return(View("../Home/Usuario/Index", new IndexViewModel(tarefaRepository.GetTarefasPorUsuario(usuarioLogado), usuarioRepository.GetUsuarios())));
 }