Exemplo n.º 1
0
 public Url GetUrl()
 {
     return(UrlShortenerUtil.Shorten(new Url
     {
         LongUrl = this.LongUrl
     }));
 }
 public IActionResult Shorten(Url url)
 {
     if (Uri.IsWellFormedUriString(url.LongUrl, UriKind.RelativeOrAbsolute))
     {
         _repository.Add(UrlShortenerUtil.Shorten(url));
         return(Redirect("Index"));
     }
     return(BadRequest("Given URL is not valid"));
 }