コード例 #1
0
        public ActionResult _Reviews(int beerId)
        {
            var reviewFacade = new ReviewFacade();

            var reviews = reviewFacade.GetByBeer(beerId);

            return View(reviews);
        }
コード例 #2
0
        public ActionResult _Review(int beerId)
        {
            var reviewFacade = new ReviewFacade();
            var rating = reviewFacade.GetReview(beerId, WebSecurity.CurrentUserId);

            if (rating != null)
            {
                return View(rating.Review);
            }

            return View(new Review() { BeerID = beerId });
        }
コード例 #3
0
        public ActionResult _Review(Review review)
        {
            if (ModelState.IsValid) {
                var reviewFacade = new ReviewFacade();

                review.UserID = WebSecurity.CurrentUserId;
                reviewFacade.Review(review);

                return View();
            }
            else {
                throw new Exception("Invalid Model State");
            }
        }