Completo prima revisione repository x commenti
This commit is contained in:
@@ -12,6 +12,7 @@
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> AddAsync(GenValueModel entity)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -19,6 +20,7 @@
|
||||
return await dbCtx.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> DeleteAsync(GenValueModel rec2del)
|
||||
{
|
||||
// Add validation for null entity
|
||||
@@ -66,12 +68,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<GenValueModel?> GetByIdAsync(int Id)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
return await dbCtx.DbSetGenVal.FirstOrDefaultAsync(x => x.GenValID == Id);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<List<GenValueModel>> GetFiltAsync(string codClass)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
@@ -81,6 +85,7 @@
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> MoveAsync(GenValueModel selRec, bool moveUp)
|
||||
{
|
||||
// Add validation for null entity
|
||||
@@ -139,11 +144,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> UpdateAsync(GenValueModel entity)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
// Recuperiamo l'entità tracciata dal context
|
||||
var trackedEntity = dbCtx.DbSetGenVal.FirstOrDefaultAsync(x => x.GenValID == entity.GenValID);
|
||||
var trackedEntity = await dbCtx.DbSetGenVal.FirstOrDefaultAsync(x => x.GenValID == entity.GenValID);
|
||||
|
||||
if (trackedEntity != null)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user