示例#1
0
    public static List <BookHistoryEvent> GetBookEvents(BookInfo bookInfo)
    {
        var events = BookHistory.GetHistory(bookInfo);

        // add in the title, which isn't in the database (this could done in a way that involves less duplication)
        events.ForEach(e =>
        {
            e.Title         = bookInfo.Title;
            e.ThumbnailPath = Path.Combine(bookInfo.FolderPath, "thumbnail.png").ToLocalhost();
        });
        return(events);
    }
示例#2
0
    public static IEnumerable <BookHistoryEvent> GetAllEvents(BookCollection collection)
    {
        var all = collection.GetBookInfos().Select(bookInfo =>
        {
            var events = BookHistory.GetHistory(bookInfo);
            // add in the title, which isn't in the database (this could done in a way that involves less duplication)
            events.ForEach(e =>
            {
                e.Title         = bookInfo.Title;
                e.ThumbnailPath = Path.Combine(bookInfo.FolderPath, "thumbnail.png").ToLocalhost();
            });
            return(events);
        });

        // strip out, if there are no events
        var booksWithHistory = from b in all where b.Any() select b;

        return(booksWithHistory.SelectMany(e => e));
    }