public bool Delete(int id) { var bll = new DataBaseNameBll(); var db = new DataBaseName(); dataBaseNames.TryRemove(id, out db); return(bll.Delete(id)); }
public bool Add(DataBaseName dataBaseName) { var bll = new DataBaseNameBll(); int id = bll.AddDataBaseName(dataBaseName); if (id > 0) { dataBaseName.ID = id; this.dataBaseNames.TryAdd(id, dataBaseName); return(true); } return(false); }
private DataBaseNameDic() { if (null == dataBaseNames) { this.dataBaseNames = new ConcurrentDictionary <int, DataBaseName>(); var bll = new DataBaseNameBll(); List <DataBaseName> list = bll.SelectList().ToList(); foreach (DataBaseName dataBaseName in list) { dataBaseNames.TryAdd(Convert.ToInt32(dataBaseName.ID), dataBaseName); } } }