示例#1
0
        public IActionResult Get(string shorturl)
        {
            URLModel urlModel = _urlService.GetShortURL(shorturl);

            if (urlModel != null)
            {
                _logger.LogInformation($"Acceso a Redirect de {urlModel.ShortURL} a {urlModel.LongURL}");
                _redirectService.SaveInfo(new RedirectModel()
                {
                    ShortURL = urlModel.ShortURL, LongURL = urlModel.LongURL
                });
                return(Redirect(urlModel.LongURL));
            }

            return(NotFound());
        }