Modifica model macchine

This commit is contained in:
Samuele E. Locatelli
2025-06-28 09:20:48 +02:00
parent 1ec3aa58d4
commit 2d83e27d89
27 changed files with 353 additions and 263 deletions
+8 -8
View File
@@ -167,18 +167,18 @@ namespace MP.Data.Services
return outVal;
}
public async Task<List<Macchine>> MacchineGetAll()
public async Task<List<MacchineModel>> MacchineGetAll()
{
Stopwatch sw = new Stopwatch();
string source = "DB";
sw.Start();
List<Macchine>? result = new List<Macchine>();
List<MacchineModel>? result = new List<MacchineModel>();
// cerco in redis...
string currKey = $"{Constants.redisMacchine}:ALL";
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<Macchine>>($"{rawData}");
result = JsonConvert.DeserializeObject<List<MacchineModel>>($"{rawData}");
source = "REDIS";
}
else
@@ -190,7 +190,7 @@ namespace MP.Data.Services
}
if (result == null)
{
result = new List<Macchine>();
result = new List<MacchineModel>();
}
sw.Stop();
Log.Debug($"MacchineGetAll | {source} | {sw.Elapsed.TotalMilliseconds}ms");
@@ -198,18 +198,18 @@ namespace MP.Data.Services
//return Task.FromResult(dbController.MacchineGetAll());
}
public async Task<List<Macchine>> MacchineGetByGruppo(string CodGruppo)
public async Task<List<MacchineModel>> MacchineGetByGruppo(string CodGruppo)
{
Stopwatch sw = new Stopwatch();
string source = "DB";
sw.Start();
List<Macchine>? result = new List<Macchine>();
List<MacchineModel>? result = new List<MacchineModel>();
// cerco in redis...
string currKey = $"{Constants.redisMacchine}:{CodGruppo}";
RedisValue rawData = redisDb.StringGet(currKey);
if (rawData.HasValue)
{
result = JsonConvert.DeserializeObject<List<Macchine>>($"{rawData}");
result = JsonConvert.DeserializeObject<List<MacchineModel>>($"{rawData}");
source = "REDIS";
}
else
@@ -222,7 +222,7 @@ namespace MP.Data.Services
}
if (result == null)
{
result = new List<Macchine>();
result = new List<MacchineModel>();
}
sw.Stop();
Log.Debug($"MacchineGetByGruppo | {source} | {sw.Elapsed.TotalMilliseconds}ms");