예제 #1
0
        public void Delete(Guid id)
        {
            Catalog entityToDelete = _context.Catalog.Find(id);

            if (entityToDelete == null)
            {
                return;
            }
            entityToDelete.Deleted = true;
            _context.Catalog.Attach(entityToDelete);
            _context.Entry(entityToDelete).State = EntityState.Modified;
        }
예제 #2
0
        public void Delete(Guid id)
        {
            CatalogItem catalogItem = _context.CatalogItem.Find(id);

            if (catalogItem == null)
            {
                return;
            }
            catalogItem.Deleted = true;
            _context.CatalogItem.Attach(catalogItem);
            _context.Entry(catalogItem).State = EntityState.Modified;
        }
예제 #3
0
        //public virtual void Delete(TEntity entityToDelete)
        //{
        //if (_context.Entry(entityToDelete).State == EntityState.Detached)
        //{
        //    _dbSet.Attach(entityToDelete);
        //}
        //_dbSet.Remove(entityToDelete);
        //}

        public virtual void Update(TEntity entityToUpdate)
        {
            _dbSet.Attach(entityToUpdate);
            _context.Entry(entityToUpdate).State = EntityState.Modified;
        }