Update metodi x usare tracking con Activity vs stopwatch
This commit is contained in:
@@ -1607,16 +1607,16 @@ namespace MP.Data.Controllers
|
||||
/// </summary>
|
||||
/// <param name="newRec"></param>
|
||||
/// <returns></returns>
|
||||
public bool MicroStatoMacchinaUpsert(MicroStatoMacchinaModel newRec)
|
||||
public async Task<bool> MicroStatoMacchinaUpsert(MicroStatoMacchinaModel newRec)
|
||||
{
|
||||
bool fatto = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var actRec = dbCtx
|
||||
var actRec = await dbCtx
|
||||
.DbSetMicroStatoMacc
|
||||
.Where(x => x.IdxMacchina == newRec.IdxMacchina)
|
||||
.AsNoTracking()
|
||||
.FirstOrDefault();
|
||||
.FirstOrDefaultAsync();
|
||||
if (actRec == null)
|
||||
{
|
||||
dbCtx
|
||||
@@ -1631,7 +1631,7 @@ namespace MP.Data.Controllers
|
||||
|
||||
dbCtx.Entry(actRec).State = EntityState.Modified;
|
||||
}
|
||||
dbCtx.SaveChanges();
|
||||
await dbCtx.SaveChangesAsync();
|
||||
fatto = true;
|
||||
}
|
||||
return fatto;
|
||||
@@ -1777,15 +1777,14 @@ namespace MP.Data.Controllers
|
||||
/// <param name="idxOdl"></param>
|
||||
/// <returns></returns>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
public ODLModel OdlGetByKey(int idxOdl)
|
||||
public async Task<ODLModel> OdlGetByKey(int idxOdl)
|
||||
{
|
||||
ODLModel dbResult = new ODLModel();
|
||||
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
dbResult = await dbCtx
|
||||
.DbSetODL
|
||||
.FirstOrDefault(x => x.IdxOdl == idxOdl);
|
||||
.FirstOrDefaultAsync(x => x.IdxOdl == idxOdl);
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user