public ActionResult <string> Get(string id) { var url = _shortenerService.Get(id); if (url is null) { return(NotFound()); } return(RedirectPermanent(url.FullUrl)); }
public ActionResult Index(string key) { if (string.IsNullOrWhiteSpace(key)) { return(View()); } else { ShortUrl url = _service.Get(key); if (url != null) { _service.AddClick(url.Id, Request.UserHostAddress); return(new RedirectResult(url.Full, true)); } else { return(View()); } } }