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); }
public string GetShortLinkWithUse(string shortUrl) { var shortLink = shortLinkRepository.GetShortLinkByShortUrl(shortUrl); if (shortLink != null) { shortLink.CountTransitions++; shortLinkRepository.UpdateShortLink(shortLink); return(shortLink.FullUrl); } return(""); }