public IActionResult Index(string id) { if (string.IsNullOrEmpty(id)) { return(RedirectToAction("Index", new { id = _idService.Generate() })); } var url = Url.Action("Control", "Home", new { id }, Request.Scheme); var viewModel = new HomeViewModel { Id = id, Url = url, }; return(View(viewModel)); }