Update metodi task2exe

This commit is contained in:
Samuele Locatelli
2026-04-15 17:07:03 +02:00
parent 3bbb952b49
commit 37a73ee2fe
7 changed files with 251 additions and 23 deletions
+33
View File
@@ -313,6 +313,39 @@ namespace MP.Data.Controllers
return fatto;
}
public async Task<bool> KeepAliveUpsertAsync(string IdxMacc, DateTime OraServer, DateTime OraMacc)
{
bool fatto = false;
using (var dbCtx = new MoonProContext(_configuration))
{
var currRec = await dbCtx
.DbSetKeepAlive
.Where(x => x.IdxMacchina == IdxMacc)
.FirstOrDefaultAsync();
if (currRec != null)
{
currRec.DataOraServer = OraServer;
currRec.DataOraMacchina = OraMacc;
dbCtx.Entry(currRec).State = EntityState.Modified;
}
else
{
KeepAliveModel newRec = new KeepAliveModel()
{
IdxMacchina = IdxMacc,
DataOraMacchina = OraMacc,
DataOraServer = OraServer,
DataOraStart = DateTime.Now
};
dbCtx
.DbSetKeepAlive
.Add(newRec);
}
fatto = await dbCtx.SaveChangesAsync() > 0;
}
return fatto;
}
public List<LinkMenuModel> ListLinkFilt(string tipoLink)
{
List<LinkMenuModel> dbResult = new List<LinkMenuModel>();