private async void QuantitySelected(ItemCatalogueModel SelectedItem) { CartPageDataService cartPageData = new CartPageDataService(); HttpResponseMessage response = await cartPageData.ServiceQuantityUpdate(SelectedItem); var status = response.StatusCode; }
private void IncQtyClicked(object obj) { ItemCatalogueModel Item = (ItemCatalogueModel)obj; Item.Quantity += 1; QuantitySelected(Item); }
private void DecQtyClicked(Object obj) { ItemCatalogueModel Item = (ItemCatalogueModel)obj; if (Item.Quantity > 1) { Item.Quantity -= 1; } }
public async Task <HttpResponseMessage> AddItemToCartService(object obj) { ItemCatalogueModel Item = (ItemCatalogueModel)obj; long Quantity = Item.Quantity; var UserId = AppSettings.GetValueOrDefault(Resources.UserId, Resources.DefaultIntValue); var formContent = MakeFormContent(UserId, Item.ItemId, Quantity); string url = Resources.APIPrefix + Resources.AddToCart; HttpClient client = new HttpClient(); HttpResponseMessage response = await client.PostAsync(url, formContent); return(response); }
public async Task <HttpResponseMessage> ServiceQuantityUpdate(ItemCatalogueModel SelectedItem) { var UserId = AppSettings.GetValueOrDefault(Resources.UserId, Resources.DefaultIntValue); var formcontent = new FormUrlEncodedContent(new[] { new KeyValuePair <string, string>(Resources.UserId, UserId), new KeyValuePair <string, string>(Resources.ItemId, SelectedItem.ItemId.ToString()), new KeyValuePair <string, string>(Resources.Quantity, SelectedItem.Quantity.ToString()) }); using (var client = new HttpClient()) { var uri = Resources.APIPrefix + Resources.UpdateItemQuantity; HttpResponseMessage response = await client.PostAsync(uri, formcontent); return(response); } }
public static List <ItemCatalogueModel> MapItemFields(String CategoryResponse) { R10Items.Clear(); dynamic CategoryJSON = JsonConvert.DeserializeObject <dynamic>(CategoryResponse); dynamic ac = CategoryJSON[0]; foreach (var item in CategoryJSON) { if (item.Descriptions != null && item.Prices != null) { ItemCatalogueModel tempCategory = new ItemCatalogueModel(); tempCategory.ItemId = item.MainId; tempCategory.ItemDescription = item.Descriptions[0].Value; tempCategory.ItemName = item.Descriptions[1].Value; tempCategory.Price = item.Prices[0].Value; R10Items.Add(tempCategory); } } return(R10Items); }
private void IncQtyClicked(Object obj) { ItemCatalogueModel Item = (ItemCatalogueModel)obj; Item.Quantity += 1; }