public async Task <ActionResult> Put([FromBody] AttractionReviewUpdateDto model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var attractionReviewFromRepo = await this._attractionRepo.GetAttractionReview(model.Id);

            if (attractionReviewFromRepo == null)
            {
                return(NotFound());
            }
            if (!await MatchAppUserWithToken((int)attractionReviewFromRepo.AppUserId))
            {
                return(Unauthorized());
            }

            _mapper.Map(model, attractionReviewFromRepo);

            try
            {
                await _attractionRepo.SaveAll();
            }
            catch (System.Exception ex)
            {
                return(BadRequest("Failed to update attraction review: " + ex.Message));
            }
            return(Ok());
        }
        public async Task <ActionResult> Post([FromBody] AttractionReviewUpdateDto model)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }
            if (!await this.MatchAppUserWithToken((int)model.AppUserId))
            {
                return(Unauthorized());
            }
            if (!await _attractionRepo.AttractionExists(model.AttractionId))
            {
                return(NotFound("Attraction " + model.AttractionId + " is not exist"));
            }
            if (await _attractionRepo.AttractionReviewed(model.AppUserId, model.AttractionId))
            {
                return(BadRequest("既にレビューされています"));
            }

            var newAttractionReview = this._mapper.Map <AttractionReview>(model);

            _attractionRepo.Add(newAttractionReview);
            if (await _attractionRepo.SaveAll() > 0)
            {
                return(CreatedAtRoute("GetAttractionReview", new { id = newAttractionReview.Id }, _mapper.Map <AttractionReviewForReturnDto>(newAttractionReview)));
            }
            return(BadRequest("Failed to add attraction review"));
        }