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> GetAllFromDB() { using (AddressbookDB 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 from gcr in db.GCR.Where(p => p.GroupId == Id && p.ContactId == c.Id && c.DateTo == "0000-00-00 00:00:00") select c).Distinct().ToList()); } }
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 g in db.Contacts.Where(x => x.Active == "0000-00-00 00:00:00") select g).ToList()); } }
public List<ContactData> GetContactsWithGroup(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(); } }
public static List <GroupData> GetAll() { //соединение и закрытие подключения автоматически using (AddressbookDB db = new AddressbookDB()) { return((from g in db.Groups select g).ToList()); } }
public static List <GroupData> GetAll() { using (AddressbookDB db = new AddressbookDB()) { return((from g in db.Groups select g).ToList()); // db.Close(); не надо прописывать, т.к. автоматом закрывается } }
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 List <GroupContactRelation> GetRelations() { using (AddressbookDB db = new AddressbookDB()) { return((from gcr in db.GCR select gcr).Distinct().ToList()); } }
public List <GroupData> GetGroups() { using (AddressbookDB db = new AddressbookDB()) { return((from g in db.Groups from gcr in db.GCR.Where(p => p.GroupId == g.Id && p.ContactId == Id && g.Deprecated == "0000-00-00 00:00:00") select g).Distinct().ToList()); } }
public static List <GroupData> GetGroups() { using (AddressbookDB db = new AddressbookDB()) { return((from g in db.Groups from gcr in db.GCR.Where(p => p.Groupid == g.Id) select g).Distinct().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") //проверяем, что контакт не удален orderby c.Modified ascending //сортируем по дате модификации, чтобы каждый раз модифицировался новый контакт select c).ToList()); } }