Skip to content

Commit

Permalink
feat: add entity deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
CarlosPavajeau committed Oct 18, 2021
1 parent 89b9410 commit c0b1556
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Armory/Shared/Infrastructure/Repositories/Repository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,11 @@ public virtual async Task<IEnumerable<T>> SearchAll()
{
return await Context.Set<T>().AsNoTracking().ToListAsync();
}

public async Task Delete(T entity)
{
Context.Set<T>().Remove(entity);
await Context.SaveChangesAsync();
}
}
}
2 changes: 2 additions & 0 deletions src/Shared/Domain/Repositories/IRepository.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,7 @@ public interface IRepository<T, in TKey> where T : class
Task<bool> Any(Expression<Func<T, bool>> predicate);

Task<IEnumerable<T>> SearchAll();

Task Delete(T entity);
}
}

0 comments on commit c0b1556

Please sign in to comment.