public static List <GroupData> GetAll() { using (AddressBookDb db = new AddressBookDb()) { return((from g in db.Groups.Where(x => x.Deprecated == "0000-00-00 00:00:00") select g).ToList()); } }
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()); } }
public static List <GroupData> GetAll() { using (var db = new AddressBookDb()) { return((from g in db.Groups select g).ToList()); } }
public List <ContactData> GetContacts() { using (AddressBookDb db = new AddressBookDb()) { return((from c in db.Contacts.Where(x => x.Deprecated == "0000-00-00 00:00:00") from gcr in db.GCR.Where(rel => rel.GroupId == Id && rel.ContactId == c.Id) select c).Distinct().ToList()); } }
public void ExecuteCmd(string cmd) { using (var db = new AddressBookDb()) { var command = db.CreateCommand(); command.CommandText = cmd; command.ExecuteNonQuery(); } }
public List <ContactData> GetContacts() { using (var 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 GroupData GetGroupWithContacts() { using (AddressBookDb db = new AddressBookDb()) { // get all relations GroupContactRelation firstRelation = (from gcr in db.GCR select gcr).ToList().First(); // get first relation and get group using group_id GroupData group = (from g in db.Groups where g.Id == firstRelation.GroupId select g).First(); return(group); } }