Example #1
0
 public ActionResult <Cat> Create([FromBody] Cat newCat) //NOTE "From the body, create a cat called newCat")
 {
     try
     {
         return(Ok(_cs.Create(newCat)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Example #2
0
 public ActionResult <Cat> Create([FromBody] Cat newCat)
 {
     try
     {
         return(Ok(_catService.Create(newCat)));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }