async Task GetData() { ViewModel = new GalleriesViewModel(); ViewModel.Galleries = new List <Gallery>(); ViewModel.Galleries = await _data.GalleriesAsync(); }
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)); }
public async Task <IActionResult> OnGet() { ViewModel = new GalleriesViewModel(); ViewModel.Galleries = new List <Gallery>(); ViewModel.Galleries = await _data.GalleriesAsync(); return(Page()); }
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)); }
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)); }