예제 #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;
         }
     }
 }
예제 #2
0
 public void Edit(BookViewModel book)
 {
     Book model = Mapper.Map<Book>(book);
     repository.EditBook(model);
 }
예제 #3
0
 public void Add(BookViewModel book)
 {
     Book model = Mapper.Map<Book>(book);
     repository.AddBook(model);
 }