public IHttpActionResult GetProduct(int id) { var person = persons.FirstOrDefault((p) => p.Id == id); if (person == null) return NotFound(); return Ok(person); }
public JsonResult GetProduct(int id) { var person = persons.FirstOrDefault(p => p.Id == id); return Json(person, JsonRequestBehavior.AllowGet); }