public List <GetPairs_Result> GetPairs(DateTime dt, string hCode) { List <GetPairs_Result> result = null; using (GBHODBEntities db = new GBHODBEntities()) { var query = (from a in db.GetPairs(hCode, dt) select a); if (query != null) { result = new List <GetPairs_Result>(); result.AddRange(query); } } return(result); }