public ActionResult TableJson(string serverName, string databaseName) { var list = new List <IdNameModel> { new IdNameModel() { Text = "全部", Value = "" } }; if (serverName != "" && databaseName != "") { var tableService = new TableLogic(); IList <TableModel> listTableModel = new List <TableModel>(); var tableModels = tableService.GetAllTable(serverName, databaseName, "dbo").ToTableModels(); if (tableModels != null) { listTableModel = tableModels.ToList(); } list.AddRange(listTableModel.Select(i => new IdNameModel() { Text = i.TableName, Value = i.TableName })); } return(Content(JsonConvert.SerializeObject(list))); }
public ActionResult TableJson(string serverName, string databaseName, string schemaName) { IList <TableModel> list = new List <TableModel>(); var tableModels = _tableService.GetAllTable(serverName, databaseName, schemaName).ToTableModels(); if (tableModels != null) { list = tableModels.ToList(); } var page = new Pagination <TableModel> { Total = list.Count, Rows = list }; return(Content(JsonConvert.SerializeObject(page))); }