public IActionResult Index(string id) { var linkToRedirect = _repository.RedirectLink(id); if (linkToRedirect != "index") { string clientIpAddress = _accessor.HttpContext.Connection.RemoteIpAddress.ToString(); _repository.SaveLinkClick(id, clientIpAddress); } return(Redirect(linkToRedirect)); }