public async Task<ActionResult> RedirectShortUrl(string hash) { var svc = new ShortUrlService(); var shortUrl = svc.GetShortUrlByHash(hash); return new RedirectResult(shortUrl.Original); }
// GET api/Shortner/5 public ShortUrl Get(string id) { var svc = new ShortUrlService(); var shortUrl = svc.GetShortUrlByHash(id); if (shortUrl == null) { throw new HttpResponseException(HttpStatusCode.NotFound); } return shortUrl; }