Esempio n. 1
0
        public IActionResult ArtWorksByCategory(int id)
        {
            var artWorkViewModel = new ArtWorkCollectionViewModel()
            {
                ArtWorkCollection = ArtisticWorkService.GetArtWorksByCategoryId(id),
                ArtWorkCategory   = ArtisticWorkService.GetCategoryById(id),
            };

            if (artWorkViewModel.ArtWorkCollection == null || artWorkViewModel.ArtWorkCategory == null)
            {
                return(RedirectToAction("Categories", "ArtisticWork"));
            }

            return(View(artWorkViewModel));
        }
        public IActionResult ArtWorkDetails(int id)
        {
            var viewModel = new ArtWorkDetailsViewModel();

            viewModel.ArtisticWork = ArtisticWorkService.GetArtisticWorkById(id);

            if (viewModel.ArtisticWork == null)
            {
                return(RedirectToAction("Categories", "ArtisticWork"));
            }

            viewModel.ArtisticWork.ArtisticWorkCategory = ArtisticWorkService.GetCategoryById(viewModel.ArtisticWork.ArtisticWorkCategoryId);

            return(View(viewModel));
        }
Esempio n. 3
0
        public IActionResult ArtWorkDetails(int id)
        {
            var currArtWork = ArtisticWorkService.GetArtisticWorkById(id);

            if (currArtWork == null)
            {
                return(RedirectToAction("Categories", "ArtisticWork"));
            }

            var currArtWorkCategory = ArtisticWorkService.GetCategoryById(currArtWork.ArtisticWorkCategoryId);

            var viewModel = mapper.Map <ArtWorkDetailsViewModel>(currArtWork);

            viewModel.ArtWorkCategory = mapper.Map <ArtWorkCategoryViewModel>(currArtWorkCategory);
            viewModel.Cloudinary      = this.cloudinaryService.GetCloudinaryInstance();

            return(View(viewModel));
        }