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)); }