private void pokazpola() { EmployeeDbcontext db = new EmployeeDbcontext(); switch (RadioButtonList1.SelectedValue) { case "Permament": { GridView1.DataSource = db.Employees.OfType <PermanentEmployee>().ToList(); GridView1.DataBind(); break; } case "Contract": { GridView1.DataSource = db.Employees.OfType <ContractEmployee>().ToList(); GridView1.DataBind(); break; } default: { GridView1.DataSource = Dane(db.Employees.ToList()); GridView1.DataBind(); break; } } }
protected void Button2_Click(object sender, EventArgs e) { EmployeeDbcontext db = new EmployeeDbcontext(); PermanentEmployee pe = new PermanentEmployee() { FirstName = "Mike", LastName = "Brown", Gender = "Male", AnnualSalary = 70000, }; db.Employees.Add(pe); db.SaveChanges(); pokazpola(); }
protected void Button1_Click(object sender, EventArgs e) { EmployeeDbcontext db = new EmployeeDbcontext(); ContractEmployee ce = new ContractEmployee() { FirstName = "Stacy", LastName = "Josh", Gender = "Female", HourlyPay = 50, HoursWorked = 120 }; db.Employees.Add(ce); db.SaveChanges(); pokazpola(); }