Ejemplo n.º 1
0
 public static List <Employee> Get()
 {
     using (var ctx = new SampleDBContext())
     {
         var e = from ent in ctx.Employee select ent;
         return(e.ToList());
     }
 }
Ejemplo n.º 2
0
 public static void AddEmployee(Employee employee)
 {
     using (var ctx = new SampleDBContext())
     {
         ctx.Employee.Add(employee);
         ctx.SaveChanges();
     }
 }
Ejemplo n.º 3
0
 public static void AddDepartment(Department department)
 {
     using (var context = new SampleDBContext())
     {
         //context.Department.Add(department);
         //context.SaveChanges();
     }
 }
Ejemplo 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());
     }
 }
Ejemplo 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
     });
 }