/// <summary> /// Initializes a new instance of the <see cref="DetailViewModel" /> class /// </summary> public NewsFeedDetailPageViewModel(Recet recet) { this.recipeName = recet.name; this.recipeAuthor = recet.author; this.dishType = recet.type; this.servings = recet.portions; this.foodType = recet.duration; this.diffcultyFactor = recet.difficulty; this.preparationTime = recet.time; this.recipeIngredients = recet.ingredients; this.recipeTags = recet.dietTag; this.preparationSteps = recet.steps; this.recipeprice = recet.price; this.recipeImage = recet.Photo; this.rating = recet.calification; this.date = recet.publication; this.FavouriteCommand = new Command(this.FavouriteButtonClicked); this.BookmarkCommand = new Command(this.BookmarkButtonClicked); this.ItemSelectedCommand = new Command(this.ItemClicked); }
public void CallAPIsyncMyMenu() { HttpClient client = new HttpClient(); SimpleLoginPage usercito = new SimpleLoginPage(); User user = usercito.GetUser(); var recet = new Recet { name = RecipeName.Text, }; var json = JsonConvert.SerializeObject(recet); StringContent content = new StringContent(json, Encoding.UTF8, "application/json"); var response = client.PostAsync($"http://192.168.1.102:8080/cooktime1/api/services/postUserMyMenuList?email={user.email}&newRecipe={recet.name}", content).Result; if (response.IsSuccessStatusCode) { { act = true; } } else { act = false; } }
public void CallAPIsync() { HttpClient client = new HttpClient(); SimpleLoginPage usercito = new SimpleLoginPage(); User user = usercito.GetUser(); var recet = new Recet { author = RecipeAuthor.Text, name = RecipeName.Text, calification = "2", steps = PreparationSteps.Text, time = DishType.Text, type = FoodType.Text, dietTag = RecipeTags.Text, price = Price.Text, portions = Servings.Text, duration = PreparationTime.Text, ingredients = RecipeIngredients.Text, photo = recetsImages[x], publication = "20/07/2020", difficulty = DifficultyFactor.Text }; var json = JsonConvert.SerializeObject(recet); StringContent content = new StringContent(json, Encoding.UTF8, "application/json"); var response = client.PostAsync($"http://192.168.1.102:8080/cooktime1/api/services/postRecipe?name={recet.name}&author={recet.author}&type={recet.type}&portions={recet.portions}&duration={recet.duration}&time={recet.time}&difficulty={recet.difficulty}&dietTag={recet.dietTag}&photo={recet.photo}&ingredients={recet.ingredients}&steps={recet.steps}&price={recet.price}&calification={recet.calification}&publication={recet.publication}", content).Result; if (response.IsSuccessStatusCode) { acc = true; x++; } else { acc = false; } }
/// <summary> /// Initializes a new instance of the <see cref="T:CookTime.Views.Detail.NewsFeedDetailPage"/> class. /// </summary> public NewsFeedDetailPage(Recet recet) { InitializeComponent(); BindingContext = new NewsFeedDetailPageViewModel(recet); }
/// <summary> /// Initializes a new instance of the <see cref="T:CookTime.Views.Detail.SearchRecipeDetailPage"/> class. /// </summary> public SearchRecipeDetailPage(Recet recet) { InitializeComponent(); BindingContext = new SearchRecipeDetailPageViewModel(recet); }