コード例 #1
0
 // Methods
 public static void CreateBook(string _title, int _authorID, DateTime _pubDate)
 {
     // This method will create a Book object and add it to the Books list.
     // Format Pub date to only have the month and year.
     using (LibraryContext context = new LibraryContext())
     {
         context.Books.Add(new Book()
         {
             Title           = _title,
             PublicationDate = _pubDate,
             AuthorID        = _authorID
         });
         Book newBook = context.Books.Last();
         BorrowController.CreateBorrow(newBook.ID);
         context.SaveChanges();
     }
 }
コード例 #2
0
 public static void ReturnBookByID(int _id)
 {
     // This method will set the ReturnedDate of the Book object with the given ID to the current date.
     BorrowController.ReturnBorrowByID(_id);
 }
コード例 #3
0
 public static void ExtendDueDateForBookByID(int _id)
 {
     // This method will extend the given book with the IDs due date by 7 days.
     BorrowController.ExtendDueDateForBorrowByID(_id);
 }