public IActionResult CreateForceUser([FromBody] TestProject.NewApplication5.Application.DTOs.ForceUsers_TestService.CreateForceUser createForceUserDto) { Guid result = default(Guid); var tso = new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted }; try { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, tso)) { var appServiceResult = _appService.CreateForceUser(createForceUserDto); result = appServiceResult; _dbContext.SaveChanges(); ts.Complete(); } } catch (Exception e) { return(StatusCode(500, e)); } return(Ok(result)); }
public IActionResult CauseCSharpError() { var tso = new TransactionOptions { IsolationLevel = IsolationLevel.ReadCommitted }; try { using (TransactionScope ts = new TransactionScope(TransactionScopeOption.Required, tso)) { _appService.CauseCSharpError(); _dbContext.SaveChanges(); ts.Complete(); } } catch (Exception e) { return(StatusCode(500, e)); } return(Ok()); }