/// <summary> /// This method brings the 3 best rated recipes from the recipe tree to be shown on the recommened section /// @author Jose A. /// </summary> private async void Pull_Better_Recipes() { HttpClient clientRecipes = new HttpClient(); string url = "http://" + LoginPage.ip + ":6969/sorting/getRatings"; var result = await clientRecipes.GetAsync(url); var json = result.Content.ReadAsStringAsync().Result; CookTime.REST_API_RecipeListModel.RecipeListModel newrecipemodel = CookTime.REST_API_RecipeListModel.RecipeListModel.FromJson(json); if (newrecipemodel.Length == 0) { return; } else { StartRecipeList(newrecipemodel); } }
/// <summary> /// Methods that converts an object type into a json file /// author Jose Antonio Espinoza. /// </summary> public static string ToJson(this RecipeListModel self) => JsonConvert.SerializeObject(self, CookTime.REST_API_RecipeListModel.Converter.Settings);