public bool isAvailable(string name) { using (var db = new KYCAIS_DEVEntities()) { return(db.mainEntities.Any((q => q.name.ToLower().Contains(name.ToLower())))); } }
public List <SearchSitesModel> getAllSites() { using (var db = new KYCAIS_DEVEntities()) { return(db.search_sites .AsNoTracking() .Where(q => q.source != null) .Select(s => new SearchSitesModel { id = s.id, name = s.name, url = s.url, source = s.source, appendString = s.appendString }) .OrderBy(q => q.id) .ToList()); } }
public MainEntityModel getEntity(string name) { using (var db = new KYCAIS_DEVEntities()) { return(db.mainEntities .AsNoTracking() .Where(q => q.name.ToLower().Contains(name.ToLower())) .Select(s => new MainEntityModel { id = s.id, name = s.name, subEntities = s.subEntities.Select(q => new SubEntityModel { id = q.id, name = q.name }).ToList() }) .SingleOrDefault()); } }