[HttpGet("{catId}")] //NOTE this route is 'api/cats/:id' public ActionResult <Cat> Get(string catId) { try { return(Ok(_cs.GetById(catId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <Cat> GetById(string id) { try { Cat cat = _catService.GetById(id); return(Ok(cat)); } catch (Exception err) { return(BadRequest(err.Message)); } }