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)));
        }
Esempio n. 2
0
 public async Task <bool> SaveAsync()
 {
     return(await _dal.SaveAsync());
 }