Ejemplo n.º 1
0
        async Task GetData()
        {
            ViewModel           = new GalleriesViewModel();
            ViewModel.Galleries = new List <Gallery>();

            ViewModel.Galleries = await _data.GalleriesAsync();
        }
Ejemplo n.º 2
0
        public ActionResult Subcategory(int id, int?page)
        {
            var galleries = _requestDataRepository.GetGalleriesBySubcategoryAndCreateDateDesc(id);

            if (galleries == null)
            {
                return(RedirectToAction("NoContent", "Home"));
            }

            var contentSubCategories = _requestDataRepository.GetContentSubcategoriesByParent_Gallery(galleries.First().CategoryId);

            var viewModel = new GalleriesViewModel
            {
                Galleries            = galleries,
                RandomEntry          = _requestDataRepository.GetRandomEntry(),
                ContentSubcategories = contentSubCategories
            };

            foreach (var gallery in viewModel.Galleries)
            {
                _galleriesService.GeneratePictureUrls(gallery);
            }

            return(View(viewModel));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> OnGet()
        {
            ViewModel           = new GalleriesViewModel();
            ViewModel.Galleries = new List <Gallery>();

            ViewModel.Galleries = await _data.GalleriesAsync();

            return(Page());
        }
Ejemplo n.º 4
0
        public ActionResult Index()
        {
            if (!ModelState.IsValid)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            var viewModel = new GalleriesViewModel
            {
                Galleries = _galleryRepo.GetGalleries()
            };

            GetSignedUser();
            if (!_signedUser.CanManageAllContent())
            {
                viewModel.Galleries = viewModel.Galleries.Where(e => e.Account.Equals(_signedUser)).ToList();
            }

            return(View(viewModel));
        }
Ejemplo n.º 5
0
        public ActionResult Category(int id, int?page)
        {
            var viewModel = new GalleriesViewModel
            {
                Galleries            = _requestDataRepository.GetGalleriesByCategoryAndCreateDateDesc(id),
                RandomEntry          = _requestDataRepository.GetRandomEntry(),
                ContentSubcategories = _requestDataRepository.GetContentSubcategoriesByParent_Gallery(id)
            };

            if (viewModel.Galleries.Count == 0)
            {
                RedirectToAction("NoContent", "Home");
            }

            foreach (var gallery in viewModel.Galleries)
            {
                _galleriesService.GeneratePictureUrls(gallery);
            }

            return(View(viewModel));
        }