IHttpActionResult and helper methods in ASP.NET Core

IHttpActionResult is now effectively IActionResult, and to return an Ok with a return object, you’d use return new ObjectResult(...);

So effectively something like this:

public IActionResult Get(int id)
{
    if (id == 1) return HttpNotFound("not found!");
    return new ObjectResult("value: " + id);
}

Here’s a good article with more detail:

http://www.asp.net/vnext/overview/aspnet-vnext/create-a-web-api-with-mvc-6

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)