Exemple #1
0
        public IActionResult Index()
        {
            var            repo = new JokesRepository(_connectionString);
            IndexViewModel vm   = new IndexViewModel();

            vm.Joke = repo.GetRandomJoke();

            if (User.Identity.IsAuthenticated)
            {
                var usersRepo = new UsersRepository(_connectionString);
                vm.User = usersRepo.GetByEmail(User.Identity.Name);
            }
            return(View(vm));
        }
Exemple #2
0
        public Joke GetRandomJoke()
        {
            var repo = new JokesRepository(_connectionString);

            return(repo.GetRandomJoke());
        }