public ActionResult <Burger> Post([FromBody] Burger burgerData) { try { Burger myBurger = _bs.AddBurger(burgerData); return(Created("api/burgers/" + myBurger.Id, myBurger)); } catch (Exception e) { return(BadRequest(e.Message)); //code snippet } }