Ejemplo n.º 1
0
        public async Task <IActionResult> Create(PizzaToCreateDto pizzaToCreate)
        {
            IServiceResult <PizzaToReturnDto> result = await _service.CreateAsync(pizzaToCreate);

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