Ejemplo n.º 1
0
        public async Task <ActionResult> ReviewProduction(int id)
        {
            ProductionService service       = new ProductionService();
            ReviewDetails     reviewDetails = new ReviewDetails();

            /*{
             *  ProductId,
             *  ProductionName,
             *  MinPrice,
             *  MaxPrice,
             *  Picture,
             *  Color
             * }*/
            // get product info by productId
            reviewDetails.product = await service.getProductionByProductId(id);

            /*
             * {
             *  ReviewId,
             *  Title,
             *  Content,
             *  OverallRating,
             *  UserName,
             *  ReviewDate,
             * }*/
            // get all reviews about a product
            List <ReviewProduction> reviewList = await service.getReviewsByProductId(id);

            reviewDetails.reviewList = reviewList;


            /*
             * rating.oneStarReviewNumber = reviewNumber.Count;
             * rating.twoStarReviewNumber = reviewNumber.Count;
             * rating.threeStarReviewNumber = reviewNumber.Count;
             * rating.fourStarReviewNumber = reviewNumber.Count;
             * rating.fiveStarReviewNumber = reviewNumber.Count;
             *
             * rating.oneStarReviewPercent
             * rating.twoStarReviewPercent
             * rating.threeStarReviewPercent
             * rating.fourStarReviewPercent
             * rating.fiveStarReviewPercent
             *
             * rating.overrallRating */
            // get all rating information of a product
            reviewDetails.rating = await service.getRatingByProductId(id);

            // render View
            return(View(reviewDetails));
        }