Exemple #1
0
        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);
        }
Exemple #2
0
 public void Begin()
 {
     databaseTransaction.Begin();
 }