Example #1
0
        public async Task <IActionResult> CreateAccount(string firstName, string lastName, string email, string password)
        {
            var tso = new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            };

            try
            {
                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, tso, TransactionScopeAsyncFlowOption.Enabled))
                {
                    await _appService.CreateAccount(firstName, lastName, email, password);

                    await _dbContext.SaveChangesAsync();

                    ts.Complete();
                }
            }
            catch (Exception e)
            {
                return(StatusCode(500, e));
            }

            return(Ok());
        }