public FlightCommandResponse(CommandResponseBase responseBase, Guid id) { Id = id; base.Success = responseBase.Success; base.StackTrace = responseBase.StackTrace; base.Error = responseBase.Error; }
public PassengerCommandResponse(CommandResponseBase responseBase, Guid id) { Id = id; base.Error = responseBase.Error; base.StackTrace = responseBase.StackTrace; base.Success = responseBase.Success; }
protected IActionResult CreateBadRequestResult(CommandResponseBase result) { return(BadRequest(new Dictionary <string, List <string> >() { { "Error", new List <string>() { result.Message } } })); }
public async Task <CommandResponseBase> Get(int id, string command) { _logger.LogInformation("Running GameServer action with ID {id} and action {action}", id, command); var gameServer = _repository.Single(DataItemPolicy <GameServer> .ById(id)); if (gameServer != null) { switch (command.ToLower()) { case "start": return(await _mediator.Send(new StartServerCommand(id))); case "stop": return(await _mediator.Send(new StopServerCommand(id))); case "restart": return(await _mediator.Send(new RestartServerCommand(id))); case "update": return(await _mediator.Send(new UpdateServerCommand(id))); default: var result = new CommandResponseBase() { status = CommandResponseStatusEnum.Error, message = $"Unknown command {command}" }; return(result); } } var errorResult = new CommandResponseBase() { status = CommandResponseStatusEnum.Error, message = $"Unable to locate server with ID {id}" }; return(errorResult); }