public IActionResult Index() { var websiteid = 3; ArticleContext articleContext = HttpContext.RequestServices.GetService(typeof(ArticleContext)) as ArticleContext; if (!articleContext.CheckConnection()) { return(Content("Could not establish connection to the database.")); } ViewData["articles"] = articleContext.GetAllArticles(websiteid).OrderByDescending(a => a.Date).ToList(); GenreContext genreContext = HttpContext.RequestServices.GetService(typeof(GenreContext)) as GenreContext; ViewData["genres"] = genreContext.ListGenres(websiteid); return(View()); }