public HomeController(ISearchRecipe recipeClient, IRepositoryClient repositoryClient, IPreferencesClient preferencesClient)
 {
     _recipeClient      = recipeClient;
     _repositoryClient  = repositoryClient;
     _preferencesClient = preferencesClient;
 }
 public MealPlanningController(ISearchRecipe recipeClient, IRepositoryClient repositoryClient)
 {
     _recipeClient     = recipeClient;
     _repositoryClient = repositoryClient;
 }
示例#3
0
 public RecipeController(ISearchRecipe recipeClient, IRepositoryClient repositoryClient)
 {
     _recipeClient     = recipeClient;
     _repositoryClient = repositoryClient;
 }
        //Ueed to map recipes we retrieve of type RecipeCalendar to convert to type RecipeInfoViewModel
        public static async Task <RecipeInfoViewModel> MealMapping(RecipeCalendar recipe, ISearchRecipe recipeClient, IRepositoryClient repositoryClient)
        {
            if (recipe == null)
            {
                return(new RecipeInfoViewModel());
            }

            string name;

            if (recipe.CustomRecipeId != null)
            {
                var recipeInfo = await repositoryClient.RetrieveCustomRecipe(recipe.UserId, recipe.CustomRecipeId);

                name = recipeInfo.RecipeName;
            }
            else
            {
                var recipeInfo = await recipeClient.SearchForRecipeById(recipe.RecipeId);

                name = recipeInfo.Title;
            }

            return(new RecipeInfoViewModel()
            {
                RecipeId = recipe.RecipeId,
                CustomRecipeId = recipe.CustomRecipeId,
                RecipeName = name
            });
        }