public static List <GroupData> GetAll()
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from g in db.Groups select g).ToList());
     }
 }
Exemple #2
0
 public static List <ContactData> GetAll()
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from g in
                 db.Contacts.Where(x => x.Deprecated == "0000-00-00 00:00:00")
                 select g).ToList());
     }
 }
 public List <ContactData> GetContacts()
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from c in db.Contacts
                 from gcr in db.GCR.Where(p => p.GroupId == Id &&
                                          p.ContactId == c.Id &&
                                          c.Deprecated == "0000 - 00 - 00 00:00:00")
                 select c).Distinct().ToList());
     }
 }
 public static List <GroupData> GetGroupsWithContacts()
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from gcr in db.GCR
                 join g in db.Groups on gcr.GroupId equals g.Id
                 join c in db.Contacts on gcr.ContactId equals c.Id
                 where (c.Deprecated == "0000 - 00 - 00 00:00:00")
                 select g
                 ).Distinct().ToList());
     }
 }