public async Task Execute(string token, CreateInstrumentCommand command) { _Logger.LogInformation($"Creating instrument with symbol: {command.Symbol}"); try { _InstrumentService.Authenticate(token); await _InstrumentService.Create(command); } catch (Exception exc) { _Logger.LogCritical($"Error Creating instrument: {exc.Message}"); throw; } }
public async Task <IActionResult> Index() { var token = this.Request.Headers["Authorization"].ToString().Substring("Bearer ".Length); _InstrumentService.Authenticate(token); try { InstrumentListItem[] instrumentListItems = await _InstrumentService.GetAsync(); return(Ok(instrumentListItems)); } catch (Exception exc) { Console.WriteLine(exc); throw; } }
public async Task Execute(string token, DeleteInstrumentCommand command) { _InstrumentService.Authenticate(token); await _InstrumentService.Delete(command); }