Beispiel #1
0
        public Task <ReviewDto> EditReview(ReviewDto updatedReview)
        {
            var review = _reviews.FirstOrDefault(r => r.CustomerId == updatedReview.CustomerId &&
                                                 r.ProductId == updatedReview.ProductId);

            if (review != null)
            {
                review.CustomerName = updatedReview.CustomerName;
                review.Timestamp    = updatedReview.Timestamp;
                review.Rating       = updatedReview.Rating;
                review.ReviewText   = updatedReview.ReviewText;
            }

            return(Task.FromResult(updatedReview));
        }
Beispiel #2
0
        public async Task <ReviewDto> NewReview(ReviewDto newReview)
        {
            var cient = _clientFactory.CreateClient();

            var disco = await cient.GetDiscoveryDocumentAsync("");

            var tokenResponse = await cient.RequestClientCredentialsTokenAsync(new ClientCredentialsTokenRequest
            {
                Address      = disco.TokenEndpoint,
                ClientId     = "customer_web_app",
                ClientSecret = "8PuT=9o6TC0i0CB#ctzR",
                Scope        = "customer_web_app"
            });

            var response = await _client.PostAsJsonAsync("api/Review", newReview);

            response.EnsureSuccessStatusCode();

            return(newReview);
        }
Beispiel #3
0
        public Task <ReviewDto> NewReview(ReviewDto newReview)
        {
            _reviews.Add(newReview);

            return(Task.FromResult(newReview));
        }