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