Fix recupero ID x nuove door
This commit is contained in:
@@ -403,8 +403,7 @@ namespace WebDoorCreator.Data.Controllers
|
||||
/// <returns></returns>
|
||||
public async Task<int> DoorInsert(DoorModel newRec)
|
||||
{
|
||||
int ordId = 0;
|
||||
//List<ItemModel> dbResult = new List<ItemModel>();
|
||||
int newId = 0;
|
||||
using (WDCDataContext localDbCtx = new WDCDataContext(_configuration))
|
||||
{
|
||||
try
|
||||
@@ -416,10 +415,11 @@ namespace WebDoorCreator.Data.Controllers
|
||||
// procedo solo se non c'è già
|
||||
if (currRec == null)
|
||||
{
|
||||
var newDbRec = localDbCtx
|
||||
.DbSetDoor
|
||||
.Add(newRec);
|
||||
ordId= await localDbCtx.SaveChangesAsync();
|
||||
var newDbRec = localDbCtx
|
||||
.DbSetDoor
|
||||
.Add(newRec);
|
||||
await localDbCtx.SaveChangesAsync();
|
||||
newId = newRec.DoorId;
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -427,7 +427,7 @@ namespace WebDoorCreator.Data.Controllers
|
||||
Log.Error($"Eccezione durante DoorInsert: {Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return ordId;
|
||||
return newId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user