示例#1
0
        public ShortLinkModel GetShortLinkByUrlKey(string urlKey, string url)
        {
            ShortLinkModel link = _repo.GetShortLinkByUrlKey(urlKey, url);

            if (link == null)
            {
                return(link);
            }

            link.RedirectsCount++;
            ShortLinkModel result = _repo.UpdateShortLink(link, url);

            if (result == null)
            {
                return(null);
            }

            return(link);
        }
示例#2
0
        public string GetShortLinkWithUse(string shortUrl)
        {
            var shortLink = shortLinkRepository.GetShortLinkByShortUrl(shortUrl);

            if (shortLink != null)
            {
                shortLink.CountTransitions++;
                shortLinkRepository.UpdateShortLink(shortLink);
                return(shortLink.FullUrl);
            }
            return("");
        }