Exemplo n.º 1
0
 public static List <GroupData> GetAllFromDB()
 {
     using (AddressBookDB db = new AddressBookDB())
     {
         return((from g in db.Groups select g).ToList());
     }
 }
Exemplo n.º 2
0
 public static List <ContactData> GetAllFromDB()
 {
     using (AddressBookDB db = new AddressBookDB())
     {
         return((from c in db.Contacts.Where(x => x.Deprecated == "0000-00-00 00:00:00") select c).ToList());
     }
 }
Exemplo n.º 3
0
 public List <ContactData> GetContacts()
 {
     using (AddressBookDB db = new AddressBookDB())
     {
         return((from c in db.Contacts
                 from groupcontactlink in db.GroupContactLink.Where(
                     p => p.GroupId == Id &&
                     p.ContactId == c.Id &&
                     c.Deprecated == "0000-00-00 00:00:00")
                 select c).Distinct().ToList());
     }
 }
Exemplo n.º 4
0
        public List <GroupData> GetGroups()
        {
            using (AddressBookDB db = new AddressBookDB())
            {
                var query = from g in db.Groups
                            join t in db.GroupContactLink on g.Id equals t.GroupId
                            where t.ContactId == Id
                            select g;

                /*
                 *          from groupcontactlink in db.GroupContactLink.Where(
                 *              p => p.ContactId == Id
                 *              && p.GroupId == g.Id)
                 *          select g;
                 */

                return(query.Distinct().ToList());
            }
        }