public IActionResult Index() { string connectName = Request.Cookies["connection_name"]; var connection = GetConnectionInfo(connectName); ViewBag.IsConnected = false; ViewBag.Connections = _service.GetConnections().data; if (connection != null) { if (OpenDatabase(connection.ConnectString)) { ViewBag.IsConnected = true; } ViewBag.ConnectName = connectName; } return(View()); }