public Rental OpenRental( Rental rental ) { if ( rental == null ) throw new ArgumentNullException( "rental" ); // Check business rules. BusinessRulesManager.Assert( "OpenRental", rental ); StorageContext.Current.Insert( rental ); return rental; }
private void buttonAccept_Click( object sender, EventArgs e ) { Book book = this.selectBookControl1.SelectedBook; if ( book == null ) { MessageBox.Show( this, "Please select a book." ); return; } Rental rental = new Rental(); rental.Book = book; rental.Customer = this.customer; rental.StartDate = DateTime.Now; rental.ScheduledReturnDate = this.returnDate; this.rentalProcesses.Value.OpenRental( rental ); this.DialogResult = DialogResult.OK; this.Close(); }