public DeeplinkDto ConvertWebLinkToDeeplink(WebUrlDto webUrlDto) { LinkType type = GetPageLinkType(webUrlDto.webUrl); DeeplinkDto deeplinkDto = null; switch (type) { case LinkType.HomePage: deeplinkDto = _homeLinkConverter.WebUrlToDeeplink(webUrlDto); break; case LinkType.ProductDetailPage: deeplinkDto = _productLinkConverter.WebUrlToDeeplink(webUrlDto); break; case LinkType.SearchPage: deeplinkDto = _searchLinkConverter.WebUrlToDeeplink(webUrlDto); break; default: deeplinkDto = _otherLinkConverter.WebUrlToDeeplink(webUrlDto); break; } return(deeplinkDto); }
public WebUrlDto DeeplinkToWebUrl(DeeplinkDto deeplinkObj) { string contentId = Regex.Match(deeplinkObj.deeplink, @"(?<=&ContentId=)\d+").Value; string boutiqueId = Regex.Match(deeplinkObj.deeplink, @"(?<=&CampaignId=)\d+").Value; string merchantId = Regex.Match(deeplinkObj.deeplink, @"(?<=&MerchantId=)\d+").Value; string c_link = $"{LinkInfoHelper.siteWeb}/brand/name-p-{contentId}"; if (!string.IsNullOrEmpty(boutiqueId)) { c_link += $"?boutiqueId={boutiqueId}"; } if (!string.IsNullOrEmpty(merchantId)) { c_link += (c_link.Contains("?") ? "&" : "?") + $"merchantId={merchantId}"; } WebUrlDto webUrlDto = new WebUrlDto() { webUrl = c_link }; return(webUrlDto); }
public WebUrlDto ConvertDeeplinkToWebLink(DeeplinkDto deeplinkDto) { LinkType type = GetPageLinkType(deeplinkDto.deeplink, false); WebUrlDto webUrlDto = null; switch (type) { case LinkType.HomePage: webUrlDto = _homeLinkConverter.DeeplinkToWebUrl(deeplinkDto); break; case LinkType.ProductDetailPage: webUrlDto = _productLinkConverter.DeeplinkToWebUrl(deeplinkDto); break; case LinkType.SearchPage: webUrlDto = _searchLinkConverter.DeeplinkToWebUrl(deeplinkDto); break; default: webUrlDto = _otherLinkConverter.DeeplinkToWebUrl(deeplinkDto); break; } return(webUrlDto); }
public DeeplinkDto WebUrlToDeeplink(WebUrlDto webUrlObj) { return(new DeeplinkDto() { deeplink = LinkInfoHelper.siteDeeplink + "?Page=Home" }); }
public WebUrlDto DeeplinkToWebUrl(DeeplinkDto deeplinkObj) { WebUrlDto webUrlDto = new WebUrlDto(); webUrlDto.webUrl = deeplinkObj.deeplink.Replace(LinkInfoHelper.siteDeeplink, LinkInfoHelper.siteWeb).Replace("?Page=Search", "/tum_urunler").Replace("&Query=", "?q="); return(webUrlDto); }
public DeeplinkDto WebUrlToDeeplink(WebUrlDto webUrlObj) { string sectionName = Regex.Match(webUrlObj.webUrl, @"(?<=\/butik\/liste\/)\w+").Value; int sectionId = sectionMap.FirstOrDefault(x => ReplaceTurkishChars(x.Value).ToUpper() == sectionName.ToUpper()).Key; DeeplinkDto deeplinkDto = new DeeplinkDto(); deeplinkDto.deeplink = $"{LinkInfoHelper.siteDeeplink}?Page=Home&SectionId={sectionId}"; return(deeplinkDto); }
public WebUrlDto DeeplinkToWebUrl(DeeplinkDto deeplinkObj) { string sectionId = Regex.Match(deeplinkObj.deeplink, @"(?<=SectionId=)\d+").Value; string sectionName = sectionMap[Convert.ToInt32(sectionId)]; WebUrlDto webUrlDto = new WebUrlDto(); webUrlDto.webUrl = $"{LinkInfoHelper.siteWeb}/butik/liste/{ReplaceTurkishChars(sectionName).ToLower(new CultureInfo("en-US", false))}"; return(webUrlDto); }
public DeeplinkDto WebUrlToDeeplink(WebUrlDto webUrlObj) { Uri unparsedUrl = new Uri(webUrlObj.webUrl); string query = unparsedUrl.Query; var qParams = HttpUtility.ParseQueryString(query); DeeplinkDto deeplinkDto = new DeeplinkDto(); deeplinkDto.deeplink = $"{LinkInfoHelper.siteWeb}?Page=Search&{qParams.ToString().Replace("q=","Query=")}"; return(deeplinkDto); }
public ShortLinkDto GetShortLink(WebUrlDto webUrlDto) { ShortLinkEntity entity = _repository.GetByWebUrl(webUrlDto.webUrl); if (entity == null) { string shortlink = ShortLinkHelper.GenerateShortLink(); DeeplinkDto deeplinkDto = _helper.ConvertWebLinkToDeeplink(webUrlDto); entity = _repository.Insert(deeplinkDto.deeplink, webUrlDto.webUrl, shortlink); } return(new ShortLinkDto() { shortlink = entity.ShortLink }); }
public DeeplinkDto WebUrlToDeeplink(WebUrlDto webUrlObj) { string contentId = Regex.Match(webUrlObj.webUrl, @"(?<=-p-)\d+").Value; Uri unparsedUrl = new Uri(webUrlObj.webUrl); var queryParams = HttpUtility.ParseQueryString(unparsedUrl.Query); string boutiqueId = queryParams["boutiqueId"]; string merchantId = queryParams["merchantId"]; string c_link = $"{LinkInfoHelper.siteDeeplink}?Page=Product&ContentId={contentId}"; c_link += (boutiqueId != null ? $"&CampaignId={boutiqueId}" : "") + (merchantId != null ? $"MerchantId={merchantId}":""); DeeplinkDto deeplinkDto = new DeeplinkDto() { deeplink = c_link }; return(deeplinkDto); }
public DeeplinkDto GetDeeplink(WebUrlDto rDto) { return(_helper.ConvertWebLinkToDeeplink(rDto)); }
public ShortLinkDto GetByWebUrl([FromBody] WebUrlDto webUrlDto) { return(_converter.GetShortLink(webUrlDto)); }