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)); }
private void InitUrlEntry(UrlEntry urlEntry) { urlEntry.ShortUrl = _serviceUrl + IdCryptographer.Encode(urlEntry.ID); urlEntry.RedirectCount = 0; urlEntry.CreationDate = DateTime.Now; }