示例#1
0
        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"));
        }
示例#2
0
        public GenreController(GenreContext context)
        {
            _context = context;

            if (_context.Genres.Count() == 0)
            {
                _context.Genres.Add(new Genre {
                    Name = "fantasy"
                });
                _context.SaveChanges();
            }
        }
示例#3
0
        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());
        }
示例#4
0
 public GenreController(GenreContext context)
 {
     _genreContext = context;
 }
示例#5
0
 public MovieDataAccess(GenreContext context, IMapper mapper)
 {
     this.Context = context;
     Mapper       = mapper;
 }
示例#6
0
 public CartoonDataAccess(GenreContext context, IMapper mapper)
 {
     this.Context = context;
     Mapper       = mapper;
 }