Update metodi task2exe
This commit is contained in:
@@ -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>();
|
||||
|
||||
Reference in New Issue
Block a user