public IActionResult GetFilteredGenres(int websiteId) { HttpContext.Session.SetInt32("websiteId", websiteId); GenreContext genreContext = HttpContext.RequestServices.GetService(typeof(GenreContext)) as GenreContext; ViewData["genres"] = genreContext.ListGenres(websiteId); return(PartialView("_Genres")); }
public GenreController(GenreContext context) { _context = context; if (_context.Genres.Count() == 0) { _context.Genres.Add(new Genre { Name = "fantasy" }); _context.SaveChanges(); } }
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()); }
public GenreController(GenreContext context) { _genreContext = context; }
public MovieDataAccess(GenreContext context, IMapper mapper) { this.Context = context; Mapper = mapper; }
public CartoonDataAccess(GenreContext context, IMapper mapper) { this.Context = context; Mapper = mapper; }