public async Task <ActionResult <IngredientDto> > CreateIngredientAsync(IngredientForCreation ingredientForCreation)
        {
            var ingredientToAdd = _mapper.Map <Ingredient>(ingredientForCreation);
            await _ingredients.CreateAsync(ingredientToAdd);

            await _ingredients.SaveAsync();

            return(CreatedAtRoute(
                       "GetIngredient",
                       new { ingredientId = ingredientToAdd.Id },
                       _mapper.Map <IngredientDto>(ingredientToAdd)));
        }
Beispiel #2
0
 public async Task CreateAsync(Ingredient ingredient)
 {
     await _dal.CreateAsync(ingredient);
 }