public async Task <IResult> RateProduct(ProductRatingReviewViewModel productRatingReview)
        {
            var result = new Result()
            {
                Operation = Operation.Create,
                Status    = Status.Success
            };

            try
            {
                ProductRatingReviewModel reviewModel = new ProductRatingReviewModel();
                reviewModel.MapFromViewModel(productRatingReview);
                reviewModel.UserId     = _specificClaim.GetSpecificClaim("Id");
                reviewModel.RatingDate = DateTime.Now;
                var rating = await _productRepository.RateProduct(reviewModel);

                return(rating);
            }
            catch (Exception e)
            {
                result.Body       = e;
                result.Message    = e.Message;
                result.Status     = Status.Error;
                result.StatusCode = HttpStatusCode.InternalServerError;
                return(result);
            }
        }
        public async Task <IResult> UpdateRating(ProductRatingReviewViewModel productRatingReview)
        {
            var result = new Result()
            {
                Operation = Operation.Update,
                Status    = Status.Success
            };

            try
            {
                int userDetail = _specificClaim.GetSpecificClaim("Id");
                var rating     = await _productRepository.GetProductRatingById(userDetail, productRatingReview.ProductId);

                if (rating.Status != Status.Success)
                {
                    result.Message    = "Rating by this user does not exist.";
                    result.Status     = Status.Fail;
                    result.StatusCode = HttpStatusCode.BadRequest;
                    return(result);
                }
                ProductRatingReviewModel productRatingModel = new ProductRatingReviewModel();
                productRatingModel.MapFromViewModel(productRatingReview);
                productRatingModel.RatingDate = DateTime.Now;
                productRatingModel.UserId     = rating.Body.UserId;
                var updateRating = await _productRepository.UpdateRating(productRatingModel);

                return(updateRating);
            }
            catch (Exception e)
            {
                result.Body       = e;
                result.Message    = e.Message;
                result.Status     = Status.Error;
                result.StatusCode = HttpStatusCode.InternalServerError;
                return(result);
            }
        }