Exemplo n.º 1
0
 public IActionResult CreateDish([FromBody] Dish dish)
 {
     try
     {
         var newDish = _service.CreateDish(dish);
         return(Created($"/api/dishes/{newDish.Id}", newDish));
     }
     catch (Exception)
     {
         return(StatusCode(StatusCodes.Status500InternalServerError, "Something unexpected happened."));
     }
 }
Exemplo n.º 2
0
        public async Task <IActionResult> Post(DishCreationDto dishCreationDto)
        {
            var result = await _dishesService.CreateDish(dishCreationDto);

            return(Ok(result));
        }