private static async Task ProcessRecipeAsync(RecipeController recCont, RecipeStepController rsCont, NavigationController navig) { NavigatorItem item = NavigatorItem.Recipe; Category targetCategory = SetTargetCategory(navig, item); Recipe recipeToAdd; bool result = false; recipeToAdd = FormRecipe(recCont); recCont.SetCategoryInRecipe(targetCategory, recipeToAdd); try { result = await recCont.TryCreateRecipeAsync(recipeToAdd); } catch (Exception) { Console.WriteLine("Creating recipe is not possible!"); Console.ReadKey(); return; } if (result) { await rsCont.AddStepsAsync(GatherSteps(recipeToAdd)); await FormIngredientListAsync(recipeToAdd, recCont); await navig.UpdateSubItems(); Console.WriteLine("Recipe created succesfully!"); } }
private static void ProcessRecipe(RecipeController recCont, CategoryController catCont, Navigator navig) { NavigatorItem item = NavigatorItem.Recipe; Category targetCategory = SetTargetCategory(navig, item); Recipe recipeToAdd = FormRecipe(recCont); recCont.SetCategoryInRecipe(targetCategory, recipeToAdd); if (recCont.TryCreateRecipe(recipeToAdd)) { Console.WriteLine("Recipe created succesfully!"); } else { Console.WriteLine("Creating recipe is not possible!"); Console.ReadKey(); return; } FormIngredientList(recipeToAdd, recCont); navig.UpdateSubItems(); }