Exemple #1
0
        private static void DeleteEmployee(int empId)
        {
            var context = new TestDBEntities();

            var emp = context.EmployeeDetails.SingleOrDefault(e => e.Emp_Id == empId);

            context.EmployeeDetails.Remove(emp);
            context.SaveChanges();
        }
Exemple #2
0
        private static void UpdateEmployeeDetails(int empId, int mgrId, string name, string designation)
        {
            var context = new TestDBEntities();

            var emp = context.EmployeeDetails.Find(empId);

            emp.Emp_MgrId       = mgrId;
            emp.Emp_Name        = name;
            emp.Emp_Designation = designation;

            context.SaveChanges();
        }
Exemple #3
0
        private static void SaveEmployeeDetails(int empId, int mgrId, string name, string designation)
        {
            var context = new TestDBEntities();

            var emp = new EmployeeDetail()
            {
                Emp_Id          = empId,
                Emp_MgrId       = mgrId,
                Emp_Name        = name,
                Emp_Designation = designation
            };

            context.EmployeeDetails.Add(emp);
            context.SaveChanges();
        }