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)); }
public IActionResult getReviews() { var reviews = _reviewRepository.GetReviews(); if (!ModelState.IsValid) { return(BadRequest(ModelState)); } return(Ok(reviews)); }