public void ReturnBook(HardCopy copy) { var history = new BookLeaningHistory { HardCopyId = copy.Id, UserLeantTo = copy.UserLeantTo.Value, LeantDate = copy.LeantDate.Value, ReturnedDate = DateTime.Now }; _libraryContext.BookLeaningHistories.InsertOnSubmit(history); _libraryContext.SubmitChanges(); }
public bool InsertBook(Book newBook) { var status = true; try { _libraryContext.Books.InsertOnSubmit(newBook); _libraryContext.SubmitChanges(); } catch (SqlException) { status = false; } return(status); }
public void Dispose() { _libraryContext.SubmitChanges(); _libraryContext.Dispose(); }