Fixed bugs
This commit is contained in:
@ -27,7 +27,7 @@ namespace UserService.DatabaseLayer.Repositories
|
||||
await db.SaveChangesAsync(token).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(T entity, CancellationToken token = default)
|
||||
public virtual async Task DeleteAsync(T entity, CancellationToken token = default)
|
||||
{
|
||||
await using var db = new UserServiceDbContext();
|
||||
Context(db).Remove(entity);
|
||||
@ -45,7 +45,7 @@ namespace UserService.DatabaseLayer.Repositories
|
||||
await using var db = new UserServiceDbContext();
|
||||
return await Context(db).Include(x => x.Parent).FirstOrDefaultAsync(predicate, token).ConfigureAwait(false);
|
||||
}
|
||||
public async Task<bool> UpdateAsync(T entity, CancellationToken token = default)
|
||||
public virtual async Task<bool> UpdateAsync(T entity, CancellationToken token = default)
|
||||
{
|
||||
await using var db = new UserServiceDbContext();
|
||||
Context(db).Update(entity);
|
||||
|
@ -22,6 +22,7 @@ namespace UserService.DatabaseLayer.Repositories
|
||||
return await Context(db)
|
||||
.Include(x => x.Parent)
|
||||
.Include(x => x.Members)
|
||||
.ThenInclude(x=> x.AttachedMember)
|
||||
.WhereOrDefault(predicate)
|
||||
.ToListAsync(token).ConfigureAwait(false);
|
||||
}
|
||||
@ -32,7 +33,16 @@ namespace UserService.DatabaseLayer.Repositories
|
||||
return await Context(db)
|
||||
.Include(x => x.Parent)
|
||||
.Include(x => x.Members)
|
||||
.ThenInclude(x=> x.AttachedMember)
|
||||
.FirstOrDefaultAsync(predicate, token).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public override async Task<bool> UpdateAsync(SecurityGroup entity, CancellationToken token = default)
|
||||
{
|
||||
await using var db = new UserServiceDbContext();
|
||||
Context(db).Update(entity);
|
||||
var items = await db.SaveChangesAsync(token).ConfigureAwait(false);
|
||||
return items > 0;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user