Update add articoli (upsert)
This commit is contained in:
@@ -322,7 +322,7 @@ namespace MP.Data.Repository.Anag
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public async Task<bool> ArticoliUpdateRecord(AnagArticoliModel editRec)
|
||||
public async Task<bool> ArticoliUpsertAsync(AnagArticoliModel editRec)
|
||||
{
|
||||
await using var dbCtx = await CreateContextAsync();
|
||||
var currRec = await dbCtx.DbSetArticoli.FirstOrDefaultAsync(x => x.CodArticolo == editRec.CodArticolo);
|
||||
@@ -333,9 +333,12 @@ namespace MP.Data.Repository.Anag
|
||||
currRec.Tipo = editRec.Tipo;
|
||||
currRec.Azienda = editRec.Azienda;
|
||||
dbCtx.Entry(currRec).State = EntityState.Modified;
|
||||
return await dbCtx.SaveChangesAsync() > 0;
|
||||
}
|
||||
return false;
|
||||
else
|
||||
{
|
||||
dbCtx.DbSetArticoli.Add(editRec);
|
||||
}
|
||||
return await dbCtx.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -140,11 +140,11 @@ namespace MP.Data.Repository.Anag
|
||||
Task<List<AnagArticoliModel>> ArticoliInKitAsync();
|
||||
|
||||
/// <summary>
|
||||
/// Update Record Articolo
|
||||
/// Upsert (add/update) Record Articolo
|
||||
/// </summary>
|
||||
/// <param name="editRec">Record da aggiornare</param>
|
||||
/// <returns>True se aggiornato</returns>
|
||||
Task<bool> ArticoliUpdateRecord(AnagArticoliModel editRec);
|
||||
Task<bool> ArticoliUpsertAsync(AnagArticoliModel editRec);
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Gruppi tipo REPARTOin formato DTO con conteggi del numero record trovati filtrati per operatore
|
||||
|
||||
Reference in New Issue
Block a user