public virtual void Delete(TEntity entityToDelete) { if (context.Entry(entityToDelete).State == EntityState.Detached) { dbSet.Attach(entityToDelete); } dbSet.Remove(entityToDelete); }
public async Task SaveDocument(Document document) { using (var context = new DMSEntities()) { context.Configuration.ProxyCreationEnabled = true; context.Entry(document).State = EntityState.Added; int x = await(context.SaveChangesAsync()); } }