Preparazione metodi x spostamento cache Async
This commit is contained in:
@@ -1273,18 +1273,14 @@ namespace MP.Data.Controllers
|
||||
/// <param name="keyKit"></param>
|
||||
/// <param name="keyExtOrd"></param>
|
||||
/// <returns></returns>
|
||||
public List<IstanzeKitModel> IstKitFilt(string keyKit, string keyExtOrd)
|
||||
public async Task<List<IstanzeKitModel>> IstKitFiltAsync(string keyKit, string keyExtOrd)
|
||||
{
|
||||
List<IstanzeKitModel> dbResult = new List<IstanzeKitModel>();
|
||||
using (var dbCtx = new MoonProContext(options))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
return await dbCtx
|
||||
.DbSetInstKit
|
||||
.Where(x => (string.IsNullOrEmpty(keyKit) && string.IsNullOrEmpty(keyExtOrd)) || (x.KeyKit.Contains(keyKit) && !string.IsNullOrEmpty(keyKit)) || (x.KeyExtOrd.Contains(keyExtOrd) && !string.IsNullOrEmpty(keyExtOrd)))
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
.ToListAsync() ?? new();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -2590,22 +2586,19 @@ namespace MP.Data.Controllers
|
||||
/// <param name="KeyFilt"></param>
|
||||
/// <param name="MaxResult"></param>
|
||||
/// <returns></returns>
|
||||
public List<TksScoreModel> TksScore(string KeyFilt, int MaxResult)
|
||||
public async Task<List<TksScoreModel>> TksScoreAsync(string KeyFilt, int MaxResult)
|
||||
{
|
||||
List<TksScoreModel> dbResult = new List<TksScoreModel>();
|
||||
if (!string.IsNullOrEmpty(KeyFilt))
|
||||
{
|
||||
using (var dbCtx = new MoonProContext(options))
|
||||
{
|
||||
var pKeyFilt = new SqlParameter("@KeyFilt", KeyFilt);
|
||||
var pMaxRes = new SqlParameter("@maxResult", MaxResult);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetTksScore
|
||||
.FromSqlRaw("EXEC stp_TKS_Search @KeyFilt, @maxResult", pKeyFilt, pMaxRes)
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
var pKeyFilt = new SqlParameter("@KeyFilt", KeyFilt);
|
||||
var pMaxRes = new SqlParameter("@maxResult", MaxResult);
|
||||
dbResult = await dbCtx
|
||||
.DbSetTksScore
|
||||
.FromSqlRaw("EXEC stp_TKS_Search @KeyFilt, @maxResult", pKeyFilt, pMaxRes)
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
@@ -2712,20 +2705,18 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="KeyFilt"></param>
|
||||
/// <returns></returns>
|
||||
public List<WipSetupKitModel> WipKitFilt(string KeyFilt)
|
||||
public async Task<List<WipSetupKitModel>> WipKitFiltAsync(string KeyFilt)
|
||||
{
|
||||
List<WipSetupKitModel> dbResult = new List<WipSetupKitModel>();
|
||||
// solo se filtro valido...
|
||||
if (!string.IsNullOrEmpty(KeyFilt))
|
||||
{
|
||||
using (var dbCtx = new MoonProContext(options))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetWipKit
|
||||
.Where(x => x.KeyFilt.Contains(KeyFilt))
|
||||
.AsNoTracking()
|
||||
.ToList();
|
||||
}
|
||||
using var dbCtx = new MoonProContext(options);
|
||||
dbResult = await dbCtx
|
||||
.DbSetWipKit
|
||||
.Where(x => x.KeyFilt.Contains(KeyFilt))
|
||||
.AsNoTracking()
|
||||
.ToListAsync();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user