Ejemplo n.º 1
0
        public int Create(EmployeePass item)
        {
            _db.EmployeePasses.Add(item);
            _db.SaveChanges();

            return(item.Id);
        }
Ejemplo n.º 2
0
        public void Update(EmployeePass item)
        {
            var entity = _db.EmployeePasses.Include(x => x.Employee).Where(x => x.Id == item.Id).AsQueryable().FirstOrDefault();

            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            _db.Entry(entity).State = EntityState.Modified;
            _db.Entry(entity).CurrentValues.SetValues(item);
            _db.Entry(entity.Employee).CurrentValues.SetValues(item.Employee);
            _db.SaveChanges();
        }