示例#1
0
        /* private List<string> GetReviewsList(Factory repositoryFactory)
         *     {
         *         return repositoryFactory.GetRateReviewRepository()
         *             .GetModels()
         *             .Where(r=> r.LocationId == Id)
         *             .Select(r=>r.Review).ToList();
         *     }
         *
         * private string  GetAverageRating(Factory repositoryFactory)
         * {
         *    if (Rating == null  )
         *    {
         *        return "No Ratings";
         *    }
         *    else
         *    {
         *
         *
         *        return repositoryFactory.GetRateReviewRepository()
         *            .GetModels()
         *            .Where(r => r.LocationId == Id)
         *            .Select(r => r.Rating).Average().ToString();
         *    }
         *
         * }*/


        public LocationListViewModel(Models.Location location, Factory repositoryFactory)
        {
            this.Id            = location.Id;
            this.Name          = location.Name;
            this.Description   = location.Description;
            this.AverageRating = Rating.Average().ToString();

            this.Review = Review; //GetReviewsList(repositoryFactory);
        }