public ActionResult Index(int dbId, string defaultTableName = null) { Session["TableName"] = defaultTableName; DbId = dbId; var tables = ModelReader.GetTableNames(); var items = tables.Select(tableName => new SelectListItem { Text = tableName, Value = tableName }).ToArray(); if (items.Length == 0) { ViewBag.NoElements = (bool?)true; } else { ViewBag.NoElements = (bool?)false; } ViewBag.DbName = DataBaseInfo.Name; if (Session["TableName"] != null) { ViewBag.dataOfTheTable = Model; } return(View(items)); }