コード例 #1
0
        public static List <BookReviewVM> GetBookReviewVMs(string baseUrl, QuerySearch query = null)
        {
            var returnBookReviews = QueryHelper.QueryList <BookReview>(query, "bookReview");
            var bookReviewVMs     = new List <BookReviewVM>();

            foreach (var br in returnBookReviews)
            {
                var vm = new BookReviewVM()
                {
                    Id           = br.Id,
                    ReviewerName = br.ReviewerName,
                    ReviewText   = br.ReviewText,
                    PublishDate  = br.PublishDate,
                    BookId       = br.BookId,
                    Rating       = br.Rating,
                };
                vm.SetDefaultLinks(baseUrl, "bookreview", br.ReviewerName);
                vm.Embed = new Embed(books: BookCollection.GetBookEmbed(baseUrl, new List <int>()
                {
                    br.BookId
                }));
                bookReviewVMs.Add(vm);
            }
            return(bookReviewVMs);
        }
コード例 #2
0
        public static List <BookReviewVM> GetBookReviewEmbed(string baseUrl, List <int> bookReviewIds)
        {
            var returnBookReviews = BookReviews.Where(x => bookReviewIds.Contains(x.Id)); //.Where(x => x.FirstName == query.Author.FirstName);
            var bookReviewVMs     = new List <BookReviewVM>();

            foreach (var br in returnBookReviews)
            {
                var vm = new BookReviewVM()
                {
                    Id           = br.Id,
                    ReviewerName = br.ReviewerName,
                    PublishDate  = br.PublishDate,
                    Rating       = br.Rating,
                };
                vm.SetDefaultLinks(baseUrl, "bookreview", br.ReviewerName);
                bookReviewVMs.Add(vm);
            }
            return(bookReviewVMs);
        }