示例#1
0
        public async Task Init()
        {
            var hotel = await _hotelService.GetById <HotelDTO>(_hotelId);

            Hotel = hotel;
            var ratingData = await _ratingService.Get <List <RatingDTO> >(new RatingSearchRequest { HotelId = hotel.Id });

            Recommender recommender = new Recommender(hotel.Id, hotel.CityId);

            var recHotels = await recommender.GetSimilarHotels();

            foreach (var recHotel in recHotels)
            {
                RecommendedHotels.Add(recHotel);
            }

            foreach (var item in ratingData)
            {
                var rating =
                    new RatingModel
                {
                    UserName   = (await _userService.GetById <UserDTO>(item.UserId)).UserName,
                    Rating     = item.HotelRating,
                    RatingDate = item.RatingDate
                };
                Reviews.Add(rating);
            }
        }