public async Task <IActionResult> GetForceUsers() { List <TestProject.NewApplication5.Application.DTOs.ForceUserQueryService_TestService.ForceUser> result = default(List <TestProject.NewApplication5.Application.DTOs.ForceUserQueryService_TestService.ForceUser>); var tso = new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted }; try { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, tso, TransactionScopeAsyncFlowOption.Enabled)) { var appServiceResult = await _appService.GetForceUsers(); result = appServiceResult; await _dbContext.SaveChangesAsync(); ts.Complete(); } } catch (Exception e) { return(StatusCode(500, e)); } return(Ok(result)); }
public async Task <IActionResult> UpdateForceUser([FromBody] TestProject.NewApplication5.Application.DTOs.ForceUsers_TestService.UpdateForceUser updateForceUserDto) { var tso = new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted }; try { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, tso, TransactionScopeAsyncFlowOption.Enabled)) { await _appService.UpdateForceUser(updateForceUserDto); await _dbContext.SaveChangesAsync(); ts.Complete(); } } catch (Exception e) { return(StatusCode(500, e)); } return(Ok()); }
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()); }