Exemplo n.º 1
0
 public List <ContactData> GetContactsListWithGroup(string groupId)
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from c in db.Contacts from gcr in db.GCR.Where(p => p.GroupId == groupId && p.ContactId == c.Id && c.Deprecated == "0000-00-00 00:00:00") select c).Distinct().ToList());
     }
 }
Exemplo n.º 2
0
 public static List <ContactData> GetAll()
 {
     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 static List <GroupData> GetAll()
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return((from g in db.Groups select g).ToList());
     }
 }
 public int AddNewRelation(int contactId, int groupId)
 {
     using (var db = new AddressbookDB())
     {
         return(db.GCR
                .Value(gcr => gcr.ContactId, contactId.ToString())
                .Value(gcr => gcr.GroupId, groupId.ToString())
                .Insert());
     }
 }
Exemplo n.º 5
0
 public int?AddContact(ContactData contact)
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return(db.Contacts
                .Value(c => c.FirstName, contact.FirstName)
                .Value(c => c.LastName, contact.LastName)
                .InsertWithInt32Identity());
     }
 }
Exemplo n.º 6
0
 public int?AddGroup(GroupData group)
 {
     using (AddressbookDB db = new AddressbookDB())
     {
         return(db.Groups
                .Value(g => g.Name, group.Name)
                .Value(g => g.Header, group.Header)
                .Value(g => g.Footer, group.Footer)
                .InsertWithInt32Identity());
     }
 }