public async Task <Detail> CreateAsync(DetailModel detail) { transaction.Begin(); var newDetail = await BuildDetailModelAsync(detail); if (await details.CreateAsync(newDetail) == null) { transaction.Rollback(); await logs.CreateAsync(new Log($"Entity {nameof(Detail)} wasn`t created.", LogLevel.Fatal)); return(null); } transaction.Commit(); await logs.CreateAsync(new Log($"Entity {nameof(Detail)} was succesfully created.", LogLevel.Info)); return(newDetail); }
public void Begin() { databaseTransaction.Begin(); }