// GET: Item/Details/5 public IActionResult Details(int?id) { if (id == null) { return(NotFound()); } var toy = _toyRepository.GetToyById(id.Value); if (toy == null) { return(NotFound()); } return(View(toy)); }
public ActionResult GetToyById(int id) { try { return(Ok(toyRepository.GetToyById(id))); } catch (Exception e) { return(BadRequest(e)); } }