Ejemplo n.º 1
0
 public bool DeleteEmploy(int id)
 {
     using (var context = new DXCEntities())
     {
         var empl = context.Db_approach.FirstOrDefault(x => x.Id == id);
         if (empl != null)
         {
             context.Db_approach.Remove(empl);
             context.SaveChanges();
             return(true);
         }
         return(false);
     }
 }
Ejemplo n.º 2
0
 public bool UpdateEmploye(int id, EmpModels model)
 {
     using (var context = new DXCEntities())
     {
         var empl = context.Db_approach.FirstOrDefault(x => x.Id == id);
         if (empl != null)
         {
             empl.FirstName = model.FirstName;
             empl.LastName  = model.LastName;
             empl.Email     = model.Email;
             empl.Code      = model.Code;
         }
         context.SaveChanges();
         return(true);
     }
 }
Ejemplo n.º 3
0
        public int AddEmploye(EmpModels model)
        {
            using (var context = new DXCEntities())
            {
                Db_approach ee = new Db_approach()
                {
                    FirstName = model.FirstName,
                    LastName  = model.LastName,
                    Email     = model.Email,
                    Code      = model.Code
                };
                context.Db_approach.Add(ee);

                context.SaveChanges();

                return(ee.Id);
            }
        }