Пример #1
0
 public static void AddOrUpdateAuthor(AppDbContext db, Book book, Author AuthorToAdd)
 {
     if (book.Author == AuthorToAdd) //new artist is the same as the original artist
     {
         //do nothing
     }
     else
     {
         book.Author = AuthorToAdd;
     }
 }
Пример #2
0
 public static void AddOrUpdateBookGenre(AppDbContext db, Book book, Genre GenreToAdd)
 {
     if (book.Genre == GenreToAdd) //new artist is the same as the original artist
     {
         //do nothing
     }
     else
     {
         book.Genre = GenreToAdd;
     }
 }
Пример #3
0
 public static Book ToDomainModel(this BookCreateViewModel bookCreateViewModel)
 {
     Book book = new Book(bookCreateViewModel.Title, bookCreateViewModel.Genre);
     book.UniqueNumber = bookCreateViewModel.UniqueNumber;
     book.Author = bookCreateViewModel.Author;
     book.Genre = bookCreateViewModel.Genre;
     book.PublicationDate = bookCreateViewModel.PublicationDate;
     book.Price = bookCreateViewModel.Price;
     //song.Genres = UpdateGenres.GetGenresFromIntList(songCreateViewModel.SelectedGenres);
     return book;
 }