Esempio n. 1
0
        public Task <string> Shorten(string url)
        {
            var shortUrl = _urlRepository.Get(url);

            if (string.IsNullOrWhiteSpace(shortUrl))
            {
                shortUrl = _urlCreator.Create(url, Model.Const.DataType.LongToShort);
                _urlRepository.Create(url, shortUrl);
            }
            return(Task.FromResult(shortUrl));
        }
        public void Create(SitemapUrlModel urlModel)
        {
            var url = _mapper.Map <SitemapUrl>(urlModel);

            _urlRepository.Create(url);
        }