Beispiel #1
0
 public bool? MakeSubscription(BookViewModel book, string userId, bool isToTheLibrary)
 {
     if (repository.isSubscribedAlready(book.ISBN, userId))
     {
         return null;
     }
     else
     {
         if ((book.Quantity > 0 & isToTheLibrary) || (book.Quantity > 1 & !isToTheLibrary))
         {
             Book model = Mapper.Map<Book>(book);
             repository.MakeSubscription(model, userId, isToTheLibrary);
             return true;
         }
         else
         {
             return false;
         }
     }
 }
Beispiel #2
0
 public void Edit(BookViewModel book)
 {
     Book model = Mapper.Map<Book>(book);
     repository.EditBook(model);
 }
Beispiel #3
0
 public void Add(BookViewModel book)
 {
     Book model = Mapper.Map<Book>(book);
     repository.AddBook(model);
 }