Completo prima revisione repository x commenti
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> AddAsync(GenClassModel entity)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -18,6 +19,7 @@
|
||||
return await dbCtx.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> DeleteAsync(GenClassModel entity)
|
||||
{
|
||||
// Add validation for null entity
|
||||
@@ -33,12 +35,14 @@
|
||||
|
||||
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<int> CountChildrenAsync(string classCod)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
return await dbCtx.DbSetGenVal.CountAsync(x => x.ClassCod == classCod);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<GenClassModel>> GetAllAsync()
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -48,12 +52,14 @@
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<GenClassModel?> GetByCodeAsync(string code)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
return await dbCtx.DbSetGenClass.FirstOrDefaultAsync(x => x.ClassCod == code);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> UpdateAsync(GenClassModel entity)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
|
||||
Reference in New Issue
Block a user