WEB API 2

In the past you had to configure http responses like this: throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); or return new HttpResponseMessage(HttpStatusCode.OK);   Now you can do the following: public IHttpActionResult GetProduct(int id) { var product = products.FirstOrDefault((p) => p.Id == id); if (product == null) { return NotFound(); } return Ok(product); } Here are a few articles […]