protected void AddButton_Click(object sender, EventArgs e) { DirectorManager manager = new DirectorManager(); Director director = new Director { FirstName = FirstNameTextBox.Text, LastName = LastNameTextBox.Text }; manager.Create(director); DoDataBind(); manager.Dispose(); }
protected void DeleteButton_Click(object sender, EventArgs e) { DirectorManager manager = new DirectorManager(); int id = Convert.ToInt32(DirectorsDropdownList.SelectedValue); manager.Delete(id); DoDataBind(); FirstNameTextBox.Text = string.Empty; LastNameTextBox.Text = string.Empty; manager.Dispose(); }
private void DoDataBind() { DirectorManager manager = new DirectorManager(); DirectorsDropdownList.DataValueField = "Id"; DirectorsDropdownList.DataTextField = "FullName"; DirectorsDropdownList.DataSource = manager.GetAll(); DirectorsDropdownList.DataBind(); UpdateTextBoxes(); manager.Dispose(); }
protected void EditButton_Click(object sender, EventArgs e) { DirectorManager manager = new DirectorManager(); Director director = new Director { FirstName = FirstNameTextBox.Text, LastName = LastNameTextBox.Text }; director.Id = Convert.ToInt32(DirectorsDropdownList.SelectedValue); manager.Update(director); DoDataBind(); manager.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { DirectorManager manager = new DirectorManager(); AllDirectors = manager.GetAll(); if (!IsPostBack) { DoDataBind(); } else { AllDirectors = manager.GetAll(); } manager.Dispose(); }
public void CleanUpAfterEachTest() { manager.Dispose(); }