コード例 #1
0
 public ActionResult<Knight> GetAll(int id)
 {
     try
      {
     return Ok(_service.GetById(id));
      }
      catch (Exception e)
      {
     return BadRequest(e.Message);
      }
 }
コード例 #2
0
 public ActionResult <Knight> GetById(int id)
 {
     try
     {
         Knight knight = _service.GetById(id);
         return(Ok(knight));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
コード例 #3
0
 public ActionResult <Knight> GetById(int id) // <-- NOTE Convert to Int for afternoon Challenge
 {
     try
     {
         Knight knight = _service.GetById(id);
         return(Ok(knight));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }