Example #1
0
        public static SerieViewModel CreateFromSerie(Serie serie,
                                                     bool includeAuthors = false,
                                                     bool includeBooks   = false)
        {
            var dto = new SerieViewModel
            {
                Id           = serie.Id,
                Title        = serie.Title,
                Description  = serie.Description,
                CreationDate = serie.CreationDate,
                CreatorId    = serie.CreatorId
            };

            if (includeAuthors)
            {
                dto.Authors = AuthorViewModel.CreateFromAuthors(serie.Books.GetAuthors());
            }

            if (includeBooks)
            {
                dto.Books = SerieBookViewModel.CreateFromSeriesBooks(serie.Books);
            }

            return(dto);
        }
Example #2
0
        public static SerieBookViewModel CreateFromSerieBook(SeriesBooks book)
        {
            var dto = new SerieBookViewModel
            {
                Order = book.Order,
                Book  = BookViewModel.CreateFromBook(book.Book)
            };

            return(dto);
        }