示例#1
0
 public List <GroupData> GetGroupsFromDB()
 {
     using (AddressBookDB db = new AddressBookDB())
     {
         return((from g in db.Groups select g).ToList());
     }
 }
 public List <ContactData> GetContactsFromDB()
 {
     using (AddressBookDB db = new AddressBookDB())
     {
         return((from c in db.Contacts
                 .Where(x => x.Deprecated == "0000-00-00 00:00:00") select c)
                .ToList());
     }
 }
示例#3
0
 public List <GroupData> GetGroupsWithContacts()
 {
     using (AddressBookDB db = new AddressBookDB())
     {
         return((from g in db.Groups
                 from c in db.GetContactRelation
                 .Where(p => p.GroupId == g.Id)
                 select g).Distinct().ToList());
     }
 }
示例#4
0
 public List <ContactData> GetContactsInGroup(int groupId)
 {
     using (AddressBookDB db = new AddressBookDB())
     {
         return((from c in db.Contacts from g in db.GetContactRelation
                 .Where(p => p.GroupId == groupId &&
                        p.ContactId == c.Id &&
                        c.Deprecated == "0000-00-00 00:00:00") select c)
                .Distinct().ToList());
     }
 }