Ejemplo n.º 1
0
        public bool EmpDelete(employee employee)
        {
            using (var context = new LuxoftDBEntities1())
            {
                var employee1 = context.employees.Where(i => i.id == employee.id)
                                .Single();

                employee1.deactivaed           = true;
                context.Entry(employee1).State = EntityState.Modified;
                context.SaveChanges();
            }
            return(true);
        }
Ejemplo n.º 2
0
        public bool AddEmployee(employee employee)
        {
            using (var context = new LuxoftDBEntities1())
            {
                employee.createdDate = DateTime.Now;
                employee.deactivaed  = false;
                employee.dob         = DateTime.Now;
                if (employee.id != 0)
                {
                    context.Entry(employee).State = EntityState.Modified;
                }
                else
                {
                    context.employees.Add(employee);
                }

                context.SaveChanges();
            }
            // Add product
            return(true);
        }