Exemple #1
0
        EBook EBook(StoreContext context, Book book)
        {
            var eBook = EBooks.FirstOrDefault(b => b.Id == book.Id);
            if (eBook != null)
                return eBook;

            eBook = new EBook { RegisteredAt = Clock.GetTime() };
            context.Books.Add(eBook);
            return eBook;
        }
Exemple #2
0
 Book Book(EBook eBook)
 {
     return new Book(
         eBook.Id,
         eBook.Isbn,
         eBook.Title,
         eBook.PublishedAt,
         eBook.Price,
         eBook.Authors.Select(a => a.Name)
     );
 }