예제 #1
0
        internal static void CreateNewRecipe(RecipeViewModel recipe)
        {
            var recipeModel = new RecipeModel()
            {
                Name = recipe.RecipeName,
                Products = string.Join(", ", recipe.Products),
                CookingSteps = recipe.CookingSteps,
                ImagePath = recipe.ImagePath
            };

            var headers = new Dictionary<string, string>();
            headers["X-accessToken"] = AccessToken;

            var response =
                HttpRequester.PostAsync<RecipeCreatedModel>(BaseServicesUrl + "recipe/new", recipeModel, headers);
        }
예제 #2
0
        private async void HandleNavigateToRecipeCommand(object obj)
        {
            if (SelectedRecipe == null)
            {
                return;
            }

            var newVM = new RecipeViewModel() { 
                RecipeName = this.SelectedRecipe.Name,
                Products = this.SelectedRecipe.Products,
                CookingSteps = this.SelectedRecipe.CookingSteps,
                ImagePath = this.SelectedRecipe.ImagePath,
                Comments = new CommentsListViewModel(){
                    CommentsList = await DataPersister.GetCommentsAsync(this.SelectedRecipe.Id),
                    RecipeId = this.SelectedRecipe.Id
                }
            };

            this.RaiseRecipeNavigate(newVM);
        }
예제 #3
0
 protected void RaiseRecipeNavigate(RecipeViewModel vm)
 {
     if (this.RecipeNavigate != null)
     {
         this.RecipeNavigate(this, new RecipeNavigateArgs(vm));
     }
 }