示例#1
0
        public ShortenedUrl Create(UrlData url)
        {
            var shortUrl = new ShortenedUrl()
            {
                Id       = Math.Abs(url.GetHashCode()),
                Url      = url.Url,
                HashedId = _converter.toBase62(Math.Abs(url.GetHashCode()))
            };

            _shortUrls.InsertOne(shortUrl);
            return(shortUrl);
        }