public void ReturnBook(Borrowing bor) { try { dataContext.usp_return_book(bor.BookCopy.Book.ISBN, bor.Customer.CustomerID, bor.BookCopy.CopyID); } catch (Exception ex) { ShowErrorMessage(ex.Message); } }
public List<Borrowing> GetAllBorrowings() { var query = from c in dataContext.get_all_borrows() select new { ISBN = c.ISBN, CopyID = c.CopyID, CustomerID = c.CustomerID, Name = c.Name }; List<Borrowing> borrowings = new List<Borrowing>(); foreach (var item in query) { Book book = new Book(); book.ISBN = item.ISBN; BookCopy bc = new BookCopy(); bc.Book = book; bc.CopyID = item.CopyID; Customer cust = new Customer(); cust.CustomerID = item.CustomerID; cust.Name = item.Name; Borrowing b = new Borrowing(); b.BookCopy = bc; b.Customer = cust; borrowings.Add(b); } return borrowings; }