public IActionResult AllJokes()
        {
            JokesRepository rep   = new JokesRepository(_connString);
            List <Joke>     jokes = rep.GetJokes().ToList();

            return(View(rep.GetJokes()));
        }
Exemple #2
0
        public IActionResult ViewAllJokes()
        {
            var         repo  = new JokesRepository(_connectionString);
            List <Joke> jokes = repo.GetJokes();

            return(View(jokes));
        }
Exemple #3
0
        public IActionResult Jokes()
        {
            var repo    = new JokesRepository(_conn);
            var jokesVm = new List <JokeViewModel>();
            var jokes   = repo.GetJokes();

            foreach (Joke j in jokes)
            {
                jokesVm.Add(new JokeViewModel
                {
                    Joke     = j,
                    Likes    = repo.GetLikesByJokeId(j.Id),
                    Dislikes = repo.GetDislikesByJokeId(j.Id),
                });
            }
            return(View(jokesVm));
        }
Exemple #4
0
        public IEnumerable <Jokes> GetAllJokes()
        {
            var repo = new JokesRepository(_connectionString);

            return(repo.GetJokes());
        }