Beispiel #1
0
        public bool CreateReview(ShowReviewCreate model)
        {
            ShowReview review = new ShowReview()
            {
                UserId     = _userId,
                ReviewText = model.ReviewText,
                Score      = model.Score,
                CreatedUtc = DateTimeOffset.Now,
                ShowId     = model.ShowId
            };

            _context.ShowReviews.Add(review);
            return(_context.SaveChanges() == 1);
        }
        public ActionResult Details(int id)
        {
            ShowReview ViewModel = new ShowReview();

            string url = "ReviewData/FindReview/" + id;
            HttpResponseMessage response = client.GetAsync(url).Result;

            if (response.IsSuccessStatusCode)
            {
                Review SelectedReview = response.Content.ReadAsAsync <Review>().Result;
                ViewModel.Review = SelectedReview;

                return(View(ViewModel));
            }

            else
            {
                return(RedirectToAction("Error"));
            }
        }