Cleanup metodi e correzioni varie
This commit is contained in:
@@ -391,6 +391,7 @@ namespace MP.Data.Controllers
|
||||
.CountAsync();
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Conteggio articoli data condizione ricerca
|
||||
/// </summary>
|
||||
@@ -429,6 +430,7 @@ namespace MP.Data.Controllers
|
||||
.OrderBy(x => x.CodArticolo)
|
||||
.CountAsync();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella Articoli IMPIEGATI (da stored stp_ART_getUsed) Async
|
||||
/// </summary>
|
||||
@@ -1827,7 +1829,7 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -1880,7 +1882,6 @@ namespace MP.Data.Controllers
|
||||
var IdxODL = new SqlParameter("@IdxODL", idxOdl);
|
||||
var IdxMacchina = new SqlParameter("@IdxMacchina", idxMacchina);
|
||||
|
||||
|
||||
// se richiesto confermo produzione
|
||||
if (confPezzi)
|
||||
{
|
||||
@@ -1971,7 +1972,7 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
@@ -2315,7 +2316,6 @@ namespace MP.Data.Controllers
|
||||
.AddAsync(editRec);
|
||||
}
|
||||
return await dbCtx.SaveChangesAsync() > 0;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2477,6 +2477,20 @@ namespace MP.Data.Controllers
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Vocabolario (completo) async
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public async Task<List<VocabolarioModel>> VocabolarioGetAllAsync()
|
||||
{
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
return await dbCtx
|
||||
.DbSetVocabolario
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Lemma)
|
||||
.ToListAsync() ?? new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Vocabolario di una lingua
|
||||
/// </summary>
|
||||
@@ -2497,17 +2511,31 @@ namespace MP.Data.Controllers
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Vocabolario (completo) async
|
||||
/// Upsert record Vocabolario
|
||||
/// </summary>
|
||||
/// <param name="upsRec"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<List<VocabolarioModel>> VocabolarioGetAllAsync()
|
||||
public async Task<bool> VocabolarioUpsertAsync(VocabolarioModel upsRec)
|
||||
{
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
return await dbCtx
|
||||
.DbSetVocabolario
|
||||
.AsNoTracking()
|
||||
.OrderBy(x => x.Lemma)
|
||||
.ToListAsync() ?? new();
|
||||
var actRec = await dbCtx
|
||||
.DbSetVocabolario
|
||||
.Where(x => x.Lingua == upsRec.Lingua && x.Lemma == upsRec.Lemma)
|
||||
.FirstOrDefaultAsync();
|
||||
|
||||
// se ci fosse aggiorno...
|
||||
if (actRec == null)
|
||||
{
|
||||
dbCtx
|
||||
.DbSetVocabolario
|
||||
.Add(upsRec);
|
||||
}
|
||||
else
|
||||
{
|
||||
actRec.Traduzione = upsRec.Traduzione;
|
||||
dbCtx.Entry(actRec).State = EntityState.Modified;
|
||||
}
|
||||
return await dbCtx.SaveChangesAsync() > 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user