public async Task <ActionResult <string> > Post([FromBody] Command value) { string myResult = await flightGear.Execute(value); if (myResult == MySimulatorModel.EverythingIsGood) { return(Ok(MySimulatorModel.EverythingIsGood)); } return(NotFound(myResult /*AppropriateError(myResult)*/)); }
public async Task <ActionResult <string> > Post([FromBody] Command value) { // If the request url is not correct, send appropirate message. if (!CheckUrlRequest()) { return(BadRequest(NoSuchUrl)); } // The url is correct, so we can execute the program with the given value. string myResult = await flightGear.Execute(value); // Check if everything is good. if (myResult == MySimulatorModel.EverythingIsGood) { return(Ok(MySimulatorModel.EverythingIsGood)); } // Something went wrong, then send the message in myResult. return(NotFound(myResult)); }