public async Task SettlementAsync([FromBody] SettlementOperationModel model) { try { await _settlementService.ExecuteAsync(model.AssetId, model.Amount, model.Comment, model.AllowChangeBalance, model.UserId); } catch (InvalidOperationException exception) { throw new ValidationApiException(HttpStatusCode.BadRequest, exception.Message); } catch (BalanceOperationException exception) { throw new ValidationApiException(HttpStatusCode.BadRequest, exception.Message); } }
public async Task ExecuteAsync() { await _semaphore.WaitAsync(); try { await _settlementService.ExecuteAsync(); } finally { _semaphore.Release(); } }