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.")); } }
public async Task <IActionResult> Post(DishCreationDto dishCreationDto) { var result = await _dishesService.CreateDish(dishCreationDto); return(Ok(result)); }