public ActionResult DbJson(string serverName) { var list = new List <IdNameModel>(); if (serverName != "") { var databaseLogic = new DatabaseLogic(); var listDatabaseModel = new List <DatabaseModel>(); var databaseModels = databaseLogic.GetAllDatabase(serverName).ToDatabaseModels(); if (databaseModels != null) { listDatabaseModel = databaseModels.ToList(); } list.AddRange(listDatabaseModel.Select(i => new IdNameModel() { Text = i.DatabaseName, Value = i.DatabaseName })); } list.Add(new IdNameModel() { Text = "全部", Value = "" }); return(Content(JsonConvert.SerializeObject(list))); }
public ActionResult DatabaseJson(string serverName) { IList <DatabaseModel> list = new List <DatabaseModel>(); var databaseModels = _databaseLogic.GetAllDatabase(serverName).ToDatabaseModels(); if (databaseModels != null) { list = databaseModels.ToList(); } var page = new Pagination <DatabaseModel> { Total = list.Count, Rows = list }; return(Content(JsonConvert.SerializeObject(page))); }