private async Task DeleteAsync()
 {
     Console.WriteLine("    Do you really want to remove the ingredient? ");
     if ((await ValidationNavigation.ShowYesNoAsync()) == ConsoleKey.N)
     {
         return;
     }
     await _ingredientsController.DeleteAsync(_ingredientId);
 }
Exemplo n.º 2
0
 private async Task DeleteAsync(int cookingStepId)
 {
     Console.WriteLine("\n    Do you really want to remove the cooking step? ");
     if (await ValidationNavigation.ShowYesNoAsync() == ConsoleKey.N)
     {
         return;
     }
     await _cookingStepsController.DeleteAsync(cookingStepId);
 }
 private async Task DeleteAsync()
 {
     Console.Write("    Attention! Are you sure you want to delete the category? You will also delete all the recipes that are in them! ");
     if ((await ValidationNavigation.ShowYesNoAsync()) == ConsoleKey.N)
     {
         return;
     }
     await _categoriesController.DeleteAsync(_categoryId);
 }
Exemplo n.º 4
0
 private async Task DeleteRecipeAsync(int recipeId)
 {
     Console.Clear();
     Console.WriteLine("\n    Are you sure you want to delete the recipe? ");
     if (await ValidationNavigation.ShowYesNoAsync() == ConsoleKey.N)
     {
         return;
     }
     await _recipesController.DeleteAsync(recipeId);
 }
Exemplo n.º 5
0
        private async Task AddAsync(int recipeId)
        {
            int currentStep = (await _cookingStepsController.GetCookingStepsWhereRecipeIdAsync(recipeId)).Any() ?
                              (await _cookingStepsController.GetCookingStepsWhereRecipeIdAsync(recipeId)).Max(x => x.Step) + 1 : 1;

            Console.WriteLine($"\n    Describe the cooking step {currentStep}: ");
            string stepName = await ValidationNavigation.CheckNullOrEmptyTextAsync(Console.ReadLine());

            await _cookingStepsController.AddAsync(recipeId, currentStep, stepName);

            Console.WriteLine("\n    Add another cooking step? ");
            if (await ValidationNavigation.ShowYesNoAsync() == ConsoleKey.N)
            {
                return;
            }
            await AddAsync(recipeId);
        }