Esempio n. 1
0
        public void AddEmployee(EmpTable emp)
        {
            //No SQL Statements, everything is OOP....
            var context = new MyDBEntities();

            context.EmpTables.Add(emp); //Adds to the Collection...
            context.SaveChanges();      //Commit to the database..
        }
Esempio n. 2
0
        public void UpdateEmployee(EmpTable emp)
        {
            var context  = new MyDBEntities();
            var selected = context.EmpTables.FirstOrDefault((e) => e.EmpID == emp.EmpID);

            selected.Empname    = emp.Empname;
            selected.EmpAddress = emp.EmpAddress;
            selected.EmpSalary  = emp.EmpSalary;
            context.SaveChanges();
        }