Exemplo n.º 1
0
        // GET: Comments/GetProductComments/5
        public ViewResult GetProductComments(int id, int?page)
        {
            var product          = _productApp.GetById(id);
            var productViewModel = Mapper.Map <Product, ProductViewModel>(product);

            var coments         = _commentApp.SearchByProduct(id);
            var productComments = Mapper.Map <IEnumerable <Comment>, IEnumerable <CommentViewModel> >(coments);

            // Set up our ViewModel
            var viewModel = new ProductCommentsViewModel
            {
                Product  = productViewModel,
                Comments = productComments
            };

            return(View(viewModel));
        }