public static List <GroupData> GetAll() { using (AddressBookDB db = new AddressBookDB()) { return((from g in db.Groups select g).ToList()); }; }
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 static List <GroupData> GetAll() { using (AddressBookDB db = new AddressBookDB()) { return((from g in db.Groups select g).ToList()); //db.Close(); //используя using метод выполняется автоматически } }
public static List <UserData> GetAll() { using (AddressBookDB db = new AddressBookDB()) { return((from u in db.Users.Where(x => x.Deprecated == "0000-00-00 00:00:00") select u).ToList()); //use db users //db.Close(); //используя using метод выполняется автоматически } }
public List <UserData> GetContactsInGroup() { using (AddressBookDB db = new AddressBookDB()) { return((from c in db.Users from gcr in db.GCR.Where(p => p.GroupId == this.Id && p.ContactId == c.Id && c.Deprecated == "0000-00-00 00:00:00") select c).Distinct().ToList()); //db.Close(); //используя using метод выполняется автоматически } }
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 List <ContactData> GetContacts() { using (var addressBookDb = new AddressBookDB()) { return((from contact in addressBookDb.Contacts from gcr in addressBookDb.GCR.Where(p => p.GroupId == Id && p.ContactId == contact.Id && contact.Deprecated == "0000-00-00 00:00:00") select contact).Distinct().ToList()); } }