Esempio n. 1
0
 public static void AddEmployee(Employee employee)
 {
     using (var ctx = new SampleDBContext())
     {
         //ctx.Employee.Add(employee);
         //ctx.SaveChanges();
     }
 }
Esempio n. 2
0
 public static void AddDepartment(Department department)
 {
     using (var context = new SampleDBContext())
     {
         //context.Department.Add(department);
         //context.SaveChanges();
     }
 }
Esempio n. 3
0
 public static List <Employee> Get()
 {
     using (var ctx = new SampleDBContext())
     {
         //var e = from ent in ctx.Employee select ent;
         //return e.ToList();
         return(new List <Employee> {
             new Employee {
                 Id = 8, EmployeeName = "TOM", Department = "HRD", IsActive = true
             }
         });
     }
 }
Esempio n. 4
0
 public static Employee EmployeeExist(Employee employee)
 {
     using (var ctx = new SampleDBContext())
     {
         //var id = from e
         //         in ctx.Employee
         //         where
         //            e.EmployeeName == employee.EmployeeName
         //            && e.Department == employee.Department
         //         select e;
         //return id.FirstOrDefault();
         return(new Employee {
             Id = 8, EmployeeName = "TOM", Department = "HRD", IsActive = true
         });
     }
 }
Esempio n. 5
0
        public static Department DepartmentExist(Department department)
        {
            using (var ctx = new SampleDBContext())
            {
                //var id = from d
                //         in ctx.Department
                //         where
                //            d.Name == department.Name
                //         select d;
                //return id.FirstOrDefault();

                return(new Department {
                    Id = 1, Name = "HRD", IsActive = true
                });
            }
        }