Esempio n. 1
0
        public ActionResult ShowReviews()
        {
            IEnumerable <ReviewDTO> reviewDtos = review.GetReviews();

            Mapper.Reset();
            Mapper.Initialize(cfg => cfg.CreateMap <ReviewDTO, ReviewViewModel>());
            var reviews = Mapper.Map <IEnumerable <ReviewDTO>, List <ReviewViewModel> >(reviewDtos);

            return(View(reviews));
        }
Esempio n. 2
0
        public IActionResult getReviews()
        {
            var reviews = _reviewRepository.GetReviews();

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            return(Ok(reviews));
        }