As simple as it sounds, I haven't found any documentation on this and perhaps I'm wording it wrong so if so, some good documentation on this would be appreciated. I simply want to return a string or a model of type string.
return "string here";
I get this error every time:
Severity    Code    Description Project File    Line
Error   CS0029  Cannot implicitly convert type 'string' to 'System.Web.Http.IHttpActionResult'  TaskManagement  C:\dev\TaskManagement\TaskManagement\Controllers\JobsController.cs  157
I've also tried using a CAST - same error.
return (IHttpActionResult)"string"
                you can do this which returns a 200 (Ok) :
public IHttpActionResult Get()
{
    return Ok("some string");
}
Take a look at the docs to see what else you can return ie: ok, badrequest etc
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With