S
S
Suarez_12015-12-08 00:03:45
C++ / C#
Suarez_1, 2015-12-08 00:03:45

Space issue using System.Web.Http?

Started writing an Api-server, but ran into a problem. I create such a Product class, add properties to it. Then I create a controller, connect the namespace using System.Web.Http, write a method

public IHttpActionResult GetProduct(int id)  // здесь ошибка Не удалось найти пространство имен IHttpActionResult 
        {
            var product = products.FirstOrDefault((p) => p.Id == id);
            if (product == null)
            {
                return NotFound();
            }
            return Ok(product);
        }

Tell me what's the matter, as far as I know IHttpActionResult is included in the System.Web.Http space?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melz, 2015-12-08
@melz

Uninstall and reinstall/upgrade Microsoft.AspNet.WebApi via NuGet. You may have to restart the studio.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question