コード例 #1
0
        public async Task <IActionResult> AddIngredient(string pizzaName, int ingredientId)
        {
            IServiceResult <PizzaToReturnDto> result = await _service.AddIngredientAsync(pizzaName, ingredientId);

            if (result.Result == ResultType.Edited)
            {
                return(CreatedAtRoute("GetPizzaByName", new { name = result.ReturnedObject.Name }, result.ReturnedObject));
            }
            else
            {
                return(BadRequest(result.Errors));
            }
        }