Example #1
0
        public async Task <IActionResult> Login(string userName, string password)
        {
            TestProject.NewApplication5.Application.DTOs.Accounts.UserLoginDto result = default(TestProject.NewApplication5.Application.DTOs.Accounts.UserLoginDto);
            var tso = new TransactionOptions {
                IsolationLevel = IsolationLevel.ReadCommitted
            };

            try
            {
                using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, tso, TransactionScopeAsyncFlowOption.Enabled))
                {
                    var appServiceResult = await _appService.Login(userName, password);

                    result = appServiceResult;

                    await _dbContext.SaveChangesAsync();

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

            return(Ok(result));
        }