Beispiel #1
0
        public static BookEditionViewModel CreateFromBookEdition(BookEdition bookEdition,
                                                                 bool includeBook       = false,
                                                                 bool includeDimensions = false,
                                                                 bool includePublisher  = false)
        {
            var dto = new BookEditionViewModel
            {
                Isbn         = bookEdition.Isbn,
                PageCount    = bookEdition.PageCount,
                PrintDate    = bookEdition.PrintDate,
                CreationDate = bookEdition.CreationDate,
                CreatorId    = bookEdition.CreatorId
            };

            if (includeBook)
            {
                dto.Book = BookViewModel.CreateFromBook(bookEdition.Book);
            }

            if (includeDimensions)
            {
                dto.Dimensions = DimensionViewModel.CreateFromDimension(bookEdition.Dimensions);
            }

            if (includePublisher)
            {
                dto.Publisher = PublisherViewModel.CreateFromPublisher(bookEdition.Publisher);
            }

            return(dto);
        }
Beispiel #2
0
        public static PublisherViewModel CreateFromPublisher(Publisher publisher, bool includeBookEditions = false)
        {
            var dto = new PublisherViewModel
            {
                Id           = publisher.Id,
                Name         = publisher.Name,
                Description  = publisher.Description,
                CreationDate = publisher.CreationDate,
                CreatorId    = publisher.CreatorId
            };

            if (includeBookEditions)
            {
                dto.BookEditions = BookEditionViewModel.CreateFromBookEditions(publisher.BookEditions);
            }

            return(dto);
        }