public static async Task <Country[]> GetCountriesAsync() { var data = await DataFeed.GetStringAsync(allCountriesQuery); var countries = from entry in XDocument.Parse(data).Descendants(DataFeed.xa + "entry").Descendants(DataFeed.xa + "content") let properties = entry.Element(DataFeed.xm + "properties") select new Country { CountryId = (string)properties.Element(DataFeed.xd + "RowKey"), CountryName = (string)properties.Element(DataFeed.xd + "CountryName"), CountryFlag250x250Url = (string)properties.Element(DataFeed.xd + "CountryFlag250x250Url") }; return(countries.ToArray()); }
public static async Task <Country> GetCountryAsync(string countryId) { var data = await DataFeed.GetStringAsync("Countries?$filter=RowKey eq '" + countryId + "'"); var countries = from entry in XDocument.Parse(data).Descendants(DataFeed.xa + "entry").Descendants(DataFeed.xa + "content") let properties = entry.Element(DataFeed.xm + "properties") select new Country { CountryId = (string)properties.Element(DataFeed.xd + "RowKey"), CountryName = (string)properties.Element(DataFeed.xd + "CountryName"), CountryFlag250x250Url = (string)properties.Element(DataFeed.xd + "CountryFlag250x250Url") }; return(countries.First()); }
public static async Task <Category[]> GetCategoriesAsync() { var data = await DataFeed.GetStringAsync(allCategoriesQuery); var categories = from entry in XDocument.Parse(data).Descendants(DataFeed.xa + "entry").Descendants(DataFeed.xa + "content") let properties = entry.Element(DataFeed.xm + "properties") select new Category { CategoryId = (string)properties.Element(DataFeed.xd + "RowKey"), Name = (string)properties.Element(DataFeed.xd + "Name"), LatestDealId = (string)properties.Element(DataFeed.xd + "LastestDealRowKey"), ImageUrl = (string)properties.Element(DataFeed.xd + "ImageUrl"), DealCount = (int)properties.Element(DataFeed.xd + "DealCount") }; return(categories.ToArray()); }
public static async Task <Category> GetCategoryAsync(string categoryId) { var data = await DataFeed.GetStringAsync("Categories?$filter=RowKey eq '" + categoryId + "'"); var categories = from entry in XDocument.Parse(data).Descendants(DataFeed.xa + "entry").Descendants(DataFeed.xa + "content") let properties = entry.Element(DataFeed.xm + "properties") select new Category { CategoryId = (string)properties.Element(DataFeed.xd + "RowKey"), Name = (string)properties.Element(DataFeed.xd + "Name"), LatestDealId = (string)properties.Element(DataFeed.xd + "LastestDealRowKey"), ImageUrl = (string)properties.Element(DataFeed.xd + "ImageUrl"), DealCount = (int)properties.Element(DataFeed.xd + "DealCount") }; return(categories.First()); }
public static async Task <DealImage[]> GetDealImagesAsync(string dealId, string size) { if (string.IsNullOrEmpty(size)) { size = "original"; } var data = await DataFeed.GetStringAsync("DealImages?$filter=(DealRowKey eq '" + dealId + "') and (Handled eq true) and (ImageSize eq '" + size + "')"); var dealImages = from entry in XDocument.Parse(data).Descendants(DataFeed.xa + "entry").Descendants(DataFeed.xa + "content") let properties = entry.Element(DataFeed.xm + "properties") select new DealImage { Name = (string)properties.Element(DataFeed.xd + "Name"), ImageUrl = (string)properties.Element(DataFeed.xd + "ImageUrl") }; return(dealImages.ToArray()); }
public static async Task <Deal[]> GetDealByWineTypeAsync(bool redWine) { var data = string.Empty; if (redWine) { data = await DataFeed.GetStringAsync("Deals?$filter=Redwine eq true"); } else { data = await DataFeed.GetStringAsync("Deals?$filter=WhiteWine eq false"); } var deals = from entry in XDocument.Parse(data).Descendants(DataFeed.xa + "entry").Descendants(DataFeed.xa + "content") let properties = entry.Element(DataFeed.xm + "properties") where (Convert.ToBoolean(properties.Element(DataFeed.xd + "Active").Value) == true) select properties; var list = await PopulateDeals(deals); return(list.Take(20).ToArray()); }
public static async void InitOrder(string orderId, string userId) { var data = await DataFeed.GetStringAsync(method + "?orderId='" + orderId + "'&userId='" + userId + "'"); }