|
@@ -396,9 +396,9 @@ namespace Luticate2.Utils.DataAccess
|
396
|
396
|
{
|
397
|
397
|
return GetNotFoundResult<T>();
|
398
|
398
|
}
|
399
|
|
- var transact = BeginTransaction(null);
|
400
|
399
|
var editRes = Execute((db, table) =>
|
401
|
400
|
{
|
|
401
|
+ var transact = BeginTransaction(db);
|
402
|
402
|
var model = GetEditQueryable(db, table).FirstOrDefault(GetExpression(new KeyValuePair<string, object>("id", guid)));
|
403
|
403
|
EditModelFromTUpdate(update, model);
|
404
|
404
|
var res = _EditSingleById(model, update, db, table);
|
|
@@ -408,16 +408,14 @@ namespace Luticate2.Utils.DataAccess
|
408
|
408
|
return res.To<T>();
|
409
|
409
|
}
|
410
|
410
|
db.SaveChanges();
|
|
411
|
+ CommitTransaction(transact);
|
411
|
412
|
return LuResult<T>.Ok(default(T));
|
412
|
413
|
});
|
413
|
414
|
if (!editRes)
|
414
|
415
|
{
|
415
|
|
- RollbackTransaction(transact);
|
416
|
416
|
return editRes;
|
417
|
417
|
}
|
418
|
|
- var getRes = GetSingleById(id).To(returnFunc);
|
419
|
|
- CommitTransaction(transact);
|
420
|
|
- return getRes;
|
|
418
|
+ return GetSingleById(id).To(returnFunc);
|
421
|
419
|
}
|
422
|
420
|
|
423
|
421
|
public virtual LuResult<TId> EditSingleByIdId(TId id, TDboUpdate update)
|