Exemplo n.º 1
0
 private static void AddCategories(AuthorBooksViewModel book, ICollection<Category> categories)
 {
     foreach (var category in categories)
     {
         book.Categories.Add(category.Name);
     }
 }
Exemplo n.º 2
0
        public static AuthorBooksViewModel Create(Book book)
        {
            var bookView = new AuthorBooksViewModel
            {
                Title = book.Title,
                Description = book.Description,
                Edition = book.Edition,
                Price = book.Price,
                Copies = book.Copies,
                ReleaseDate = book.ReleaseDate,
                AgeRestriction = book.AgeRestriction,
                Categories = new List<string>(),

            };

            AddCategories(bookView, book.Categories);

            return bookView;
        }