public IActionResult Overview(int itemId)
        {
            ReviewViewModel model = new ReviewViewModel();

            model.listofReviews = new List <ReviewItemViewModel>();
            var mapperReview = mapperHelper.ReviewToReviewItemViewModel();

            foreach (Review r in reviewRepo.RetrieveAllReviews())
            {
                ReviewItemViewModel rmodel = mapperReview.Map <ReviewItemViewModel>(r);
                model.listofReviews.Add(rmodel);
            }

            if (itemId != 0)
            {
                Review r = reviewRepo.RetrieveReviewById(itemId);
                model.reviewId      = r.RetrieveId();
                model.reviewMessage = r.RetrieveMessage();
                model.reviewName    = r.RetrieveName();
            }

            return(View("ReviewOverview", model));
        }
Example #2
0
        public IActionResult Index()
        {
            HomeViewModel model = new HomeViewModel();

            model.listofReviews = new List <ReviewItemViewModel>();
            var mapperReview = mapperHelper.ReviewToReviewItemViewModel();

            foreach (Review r in reviewRepo.RetrieveAllReviews())
            {
                ReviewItemViewModel rmodel = mapperReview.Map <ReviewItemViewModel>(r);
                model.listofReviews.Add(rmodel);
            }

            model.listofPortfolioitems = new List <PortfolioItemViewModel>();
            var mapperPortfolio = mapperHelper.PortfolioItemToPortfolioItemViewModel();

            foreach (PortfolioItem p in portfolioRepo.RetrieveAllItems())
            {
                PortfolioItemViewModel pmodel = mapperPortfolio.Map <PortfolioItemViewModel>(p);
                model.listofPortfolioitems.Add(pmodel);
            }

            return(View("Index", model));
        }