Ejemplo n.º 1
0
 public void InsertTable(string firstName)
 {
     LinqPracDBDataContext pracDb = new LinqPracDBDataContext();
     t1 t = new t1();
     t.firstName = firstName;
     pracDb.t1s.InsertOnSubmit(t);
     pracDb.SubmitChanges();
 }
Ejemplo n.º 2
0
 public void UpdateTable(Table1 table)
 {
     LinqPracDBDataContext pracDb = new LinqPracDBDataContext();
     var enTable1 = from tt1 in pracDb.t1s
                    where tt1.t1id == table.ID
                    select tt1;
     t1 t = enTable1.First<t1>();
     t.firstName = table.FirstName;
     pracDb.SubmitChanges();
 }
Ejemplo n.º 3
0
 public void UpdateEmployeeTable(EmployeeTable table)
 {
     LinqPracDBDataContext dbContext = new LinqPracDBDataContext();
     //var empTable = dbContext.EmployeeTables.Select(e => e.Employeeid == table.Employeeid);
     var empTable = from emp in dbContext.EmployeeTables where emp.Employeeid == table.Employeeid select emp;
     EmployeeTable employeeTable = empTable.First<EmployeeTable>();
     employeeTable.BirthDate = table.BirthDate;
     employeeTable.LoginID = table.LoginID;
     employeeTable.Title = table.Title;
     dbContext.SubmitChanges();
 }
Ejemplo n.º 4
0
 public void DeleteTable(int id)
 {
     LinqPracDBDataContext pracDb = new LinqPracDBDataContext();
     pracDb.t1s.DeleteOnSubmit(pracDb.t1s.Select(e => e).Where(w => w.t1id == id).First<t1>());
     pracDb.SubmitChanges();
 }
Ejemplo n.º 5
0
 public List<EmployeeTable> GetEmployeeTable()
 {
     LinqPracDBDataContext dbContext = new LinqPracDBDataContext();
     return dbContext.EmployeeTables.ToList<EmployeeTable>();
 }