Ejemplo n.º 1
0
 public IActionResult Create(Drink drink)
 {
     if (ModelState.IsValid)
     {
         Drink d = _ds.Create(drink);
         return(RedirectToAction(nameof(Index)));
     }
     return(View(drink));
 }
 public ActionResult <Drink> Create([FromBody] Drink newDrink)
 {
     try
     {
         return(Ok(_service.Create(newDrink)));
     }
     catch (System.Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Ejemplo n.º 3
0
 public ActionResult <Burger> Create([FromBody] Drink newDrink)
 {
     try
     {
         Drink drink = _ds.Create(newDrink);
         return(Ok(drink));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }