public ActionResult Entry(int id)
        {
            var entry = _requestDataRepository.GetElement <Entry>(id);
            var contentSubcategories = _requestDataRepository.GetContentSubcategoriesByParent_Entry(entry.CategoryId);

            var viewModel = new EntryViewModel
            {
                Entry = entry,
                ContentSubcategories = contentSubcategories,
                RandomEntry          = _requestDataRepository.GetRandomEntry()
            };

            if (viewModel.Entry == null)
            {
                return(RedirectToAction("NoContent", "Home"));
            }

            return(View(viewModel));
        }
Esempio n. 2
0
        public ActionResult Gallery(int id)
        {
            var gallery = _requestDataRepository.GetElement <Gallery>(id);

            var viewModel = new GalleryViewModel()
            {
                Gallery              = gallery,
                RandomEntry          = _requestDataRepository.GetRandomEntry(),
                ContentSubcategories = _requestDataRepository.GetContentSubcategoriesByParent_Gallery(gallery.CategoryId)
            };

            if (viewModel.Gallery == null)
            {
                RedirectToAction("NoContent", "Home");
            }

            _galleriesService.GeneratePictureUrls(viewModel.Gallery);

            return(View(viewModel));
        }