public IActionResult ViewShortUrl(string hash) { var urlRepo = new ShortenedUrlsRepository(_connectionString); var url = urlRepo.GetByHash(hash); if (url == null) { return(Redirect("/")); } urlRepo.AddView(url.Id); return(Redirect(url.OriginalUrl)); }