示例#1
0
        public UrlEntry GetUrlEntryByShortUrl(string url)
        {
            if (_urlEntriesContext.UrlEntries.Count() == 0)
            {
                return(null);
            }

            var id = IdCryptographer.Decode(url);

            return(_urlEntriesContext.UrlEntries.FirstOrDefault(x => x.ID == id));
        }
示例#2
0
 private void InitUrlEntry(UrlEntry urlEntry)
 {
     urlEntry.ShortUrl      = _serviceUrl + IdCryptographer.Encode(urlEntry.ID);
     urlEntry.RedirectCount = 0;
     urlEntry.CreationDate  = DateTime.Now;
 }