public IActionResult Create(Burger burger)
 {
     if (ModelState.IsValid)
     {
         Burger b = _bs.Create(burger);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(burger));
 }
 public ActionResult <Burger> Create([FromBody] Burger newData)
 {
     try
     {
         return(Ok(_bs.Create(newData)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemplo n.º 3
0
 public ActionResult <Burger> Post([FromBody] Burger newBurger)
 {
     try
     {
         return(Ok(_service.Create(newBurger)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
 public ActionResult <Burger> Create([FromBody] Burger newBurger)
 {
     try
     {
         return(Ok(_burgersService.Create(newBurger)));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }
Exemplo n.º 5
0
 public ActionResult <Burger> Create([FromBody] Burger burger)
 {
     try
     {
         return(Ok(_bs.Create(burger)));
     }
     catch (System.Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemplo n.º 6
0
 public ActionResult <Burger> Create([FromBody] Burger newData) //NOTE "From the body, create a burger called newBurger")
 {
     try
     {
         return(Ok(_bs.Create(newData)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Exemplo n.º 7
0
 public ActionResult <Burger> Post([FromBody] Burger newBurger)
 {
     try
     {
         Burger burgers = _burgerService.Create(newBurger);
         return(Ok(burgers));
     }
     catch (Exception err)
     {
         return(BadRequest(err.Message));
     }
 }
Exemplo n.º 8
0
 public ActionResult <Burger> Create([FromBody] Burger newBurger)
 {
     try
     {
         Burger burger = _ds.Create(newBurger);
         return(Ok(burger));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }