public static AssetCatogry FindByAstCatId(int? _VaidationID) { NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString); var dbAssetCatogrys = from u in newAppsCnn.Ast_AssetCatogry where u.AstCatId == _VaidationID select u; if (dbAssetCatogrys.Count() > 0) { Ast_AssetCatogry dbAssetCatogry = dbAssetCatogrys.First(); AssetCatogry account = new AssetCatogry(); account.FromDbAssetCatogry(dbAssetCatogry); account.IsNew = false; account.IsCopy = false; return account; } else return null; }
public static List<AssetCatogry> GetAllAssetCatogryTree() { List<AssetCatogry> result = new List<AssetCatogry>(); NewAppsCnn newAppsCnn = new NewAppsCnn(AppSettings.CrAppSettings.NewAppsConnectionString); var dbAssetCatogrys = from g in newAppsCnn.Ast_AssetCatogry select g; foreach (var dbAssetCatogry in dbAssetCatogrys) { AssetCatogry account = new AssetCatogry(); account.FromDbAssetCatogry(dbAssetCatogry); result.Add(account); } return result; }