private void addNewDriver() { using (FormulaOneDataContext Data = new FormulaOneDataContext()) { Driver driver = new Driver(); driver.FirstName = FirstNameTxt.Text; driver.SecondName = SecondNameTxt.Text; driver.TeamID = Int32.Parse(DropDownTeams.SelectedValue); Data.Drivers.InsertOnSubmit(driver); Data.SubmitChanges(); Response.Redirect("~/AddDriver"); } }
protected void addTeamBtn_Click(object sender, EventArgs e) { using (FormulaOneDataContext Data = new FormulaOneDataContext()) { Team team = new Team(); team.TeamName = TeamNameTxt.Text; team.Constructor = ConstructorTxt.Text; team.Chassis = ChassisTxt.Text; team.Engine = EngineTxt.Text; Data.Teams.InsertOnSubmit(team); Data.SubmitChanges(); Response.Redirect("~/AddTeam"); } }