public IActionResult AllJokes() { JokesRepository rep = new JokesRepository(_connString); List <Joke> jokes = rep.GetJokes().ToList(); return(View(rep.GetJokes())); }
public IActionResult ViewAllJokes() { var repo = new JokesRepository(_connectionString); List <Joke> jokes = repo.GetJokes(); return(View(jokes)); }
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)); }
public IEnumerable <Jokes> GetAllJokes() { var repo = new JokesRepository(_connectionString); return(repo.GetJokes()); }