Ejemplo n.º 1
0
        public IHttpActionResult GetDetail(int touristAttractionID)
        {
            TouristAttractionActivity oTouristAttractionActivity = new TouristAttractionActivity();
            TAReviewActivity          oTAReviewActivity          = new TAReviewActivity();
            TAPhotoActivity           oTAPhoto = new TAPhotoActivity();

            _taSuggestions = new List <dynamic>();
            _taPhotos      = new List <dynamic>();


            _touristAttraction = oTouristAttractionActivity.GetTouristAttraction(touristAttractionID);
            _avgRating         = oTAReviewActivity.GetAverageRating(touristAttractionID);
            _taPhotos          = oTAPhoto.GetTAPhotos(touristAttractionID);
            _taSuggestions     = oTouristAttractionActivity.GetTASuggestions(touristAttractionID);
            _reviews           = oTAReviewActivity.GetTAReviews(touristAttractionID);
            _IDs          = oTAReviewActivity.GetTAReviewIDs(touristAttractionID);
            _childReviews = oTAReviewActivity.GetTAReviews(_IDs);

            if (_taPhotos == null)
            {
                _taPhotos = new List <dynamic> {
                    new { Photo = string.Empty }
                }
            }
            ;

            if (_taSuggestions == null)
            {
                _taSuggestions = new List <dynamic> {
                    new { ID = string.Empty, Name = string.Empty, Photo = string.Empty, Type = string.Empty }
                }
            }
            ;

            if (_reviews == null)
            {
                _reviews = new List <dynamic> {
                    new { ReviewID = string.Empty, Rating = string.Empty, Review = string.Empty, ReviewDate = string.Empty, UserID = string.Empty, UserName = string.Empty, UserPhoto = string.Empty }
                }
            }
            ;

            if (_childReviews == null)
            {
                _childReviews = new List <dynamic> {
                    new { ParentID = string.Empty, ReviewID = string.Empty, Review = string.Empty, ReviewDate = string.Empty, UserID = string.Empty, UserName = string.Empty, UserPhoto = string.Empty }
                }
            }
            ;

            _data = CommonHelper.GenerateTADetailJObject(_touristAttraction, _avgRating, _taPhotos, _taSuggestions, _reviews, _childReviews);

            return(Ok(_data));
        }
Ejemplo n.º 2
0
        public IHttpActionResult GetReviewedTAttraction(int userID)
        {
            TAReviewActivity oTAReviewActivity = new TAReviewActivity();

            _touristAttractions = new List <dynamic>();

            _touristAttractions = oTAReviewActivity.GetReviewedTAttraction(userID);

            _data = CommonHelper.GenerateReviewedTAJObject(_touristAttractions);

            return(Ok(_data));
        }
Ejemplo n.º 3
0
        public IHttpActionResult PostReview(TAReview oTAReview)
        {
            _otAReview = new TAReview();
            TAReviewActivity oTAReviewActivity = new TAReviewActivity();

            _otAReview.UserID = oTAReview.UserID;
            _otAReview.TouristAttractionID = oTAReview.TouristAttractionID;
            _otAReview.Rating = oTAReview.Rating;
            _otAReview.Review = oTAReview.Review != null ? oTAReview.Review : string.Empty;

            _otAReview = oTAReviewActivity.Save(_otAReview);

            return(Ok(_data));
        }