IEnumerator LoadUrlImageCo(Image targetImage, string Url, StoreUrl buttonUrlHolder) { UnityWebRequest www = UnityWebRequestTexture.GetTexture(Url); var asyncOperation = www.SendWebRequest(); float progress; while (!www.isDone) { progress = asyncOperation.progress; yield return(null); } progress = 1f; if (!string.IsNullOrEmpty(www.error)) { Debug.Log(www.error); Url = null; } var texture = DownloadHandlerTexture.GetContent(www); targetImage.sprite = Sprite.Create(texture, new Rect(0, 0, texture.width, texture.height), new Vector2(0, 0)); buttonUrlHolder.buttonUrl = Url; }
public async Task UpdateUrl(StoreUrl url) { using (var context = new StoreContext()) { context.StoreUrls.Update(url); await context.SaveChangesAsync(); } }
public string GetOrderUrl() { if (StoreUrl.IsEmpty() || OrderId == 0) { return(string.Empty); } return($"{StoreUrl}/Admin/Orders/ViewOrder.aspx?OrderId={OrderId}"); }
/// <summary> /// Добавляем url и формируем его короткую версию. /// </summary> /// <param name="url">url-адресс.</param> /// <returns></returns> public async Task AddUrl(string url) { var hashUrl = new HashUrl(); var result = new StoreUrl() { LongUrl = url, ShortUrl = hashUrl.Create(url), Created = DateTime.Now, Count = 0 }; await _repository.AddUrl(result); }
public async Task <StoreUrl> FindUrl(string shortUrl) { var result = new StoreUrl(); using (var context = new StoreContext()) { var query = context.StoreUrls.AsQueryable(); result = await query.Where(q => q.ShortUrl.Equals(shortUrl)).FirstOrDefaultAsync(); } return(result); }
public async Task DeleteUrl(int urlId) { using (var context = new StoreContext()) { var url = new StoreUrl() { ID = urlId }; context.StoreUrls.Remove(url); await context.SaveChangesAsync(); } }
/// <summary> /// Returns a hash code for this instance. /// </summary> /// <returns> /// A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table. /// </returns> public override int GetHashCode() { unchecked { int result = Id; result = (result * 397) ^ (Name != null ? Name.GetHashCode() : 0); result = (result * 397) ^ (ImageUrl != null ? ImageUrl.GetHashCode() : 0); result = (result * 397) ^ (StatsUrl != null ? StatsUrl.GetHashCode() : 0); result = (result * 397) ^ (StoreUrl != null ? StoreUrl.GetHashCode() : 0); result = (result * 397) ^ PlayedRecently.GetHashCode(); return(result); } }
public override int GetHashCode() { unchecked { var hashCode = StoreId.GetHashCode(); hashCode = (hashCode * 397) ^ (Name != null ? Name.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (Description != null ? Description.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (FriendlyName != null ? FriendlyName.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (ImageUrl != null ? ImageUrl.GetHashCode() : 0); hashCode = (hashCode * 397) ^ (StoreUrl != null ? StoreUrl.GetHashCode() : 0); hashCode = (hashCode * 397) ^ CouponsCount.GetHashCode(); return(hashCode); } }
public async Task <float> GetRegionalPrice(string regionCode) { var url = StoreUrl.Replace(".com/", $".com/{regionCode}/"); using (var http = XboxScraper.Http) using (var res = await http.GetAsync(url)) if (res.IsSuccessStatusCode) { var doc = new HtmlDocument(); doc.LoadHtml(await res.Content.ReadAsStringAsync()); return(ParsePrice(doc.DocumentNode.Descendants("div").Where(o => o.GetAttributeValue("class", "") == "price-disclaimer ").FirstOrDefault()?.Element("span")?.InnerText)); } return(0); }
public async Task UpdateUrl([FromBody] StoreUrl store) { await _storeService.UpdateUrl(store.ID, store.LongUrl); }