public List <Entity.Persons.Person> GetByUserNameList(string userName) { try { List <Entity.Persons.Person> persons = new List <Entity.Persons.Person>(); var items = db.Credentials.Where(x => x.Username == userName).Select(c => new Qiyas.BusinessLogicLayer.Entity.Persons.Credential(c) { context = db }); if (items != null) { foreach (Entity.Persons.Credential cred in items) { BusinessLogicLayer.Entity.Persons.Person person = new Entity.Persons.Person(cred.BusinessEntityId); person.CurrentCredential = cred; persons.Add(person); } } return(persons); } catch (Exception ex) { lastException = ex; return(null); } }
public Entity.Persons.Person GetByID(int id) { try { Entity.Persons.Person person = null; var item = (from x in db.Persons where x.BusinessEntityId == id select x).FirstOrDefault(); if (item != null) { person = new Entity.Persons.Person(item); } return(person); } catch (Exception ex) { lastException = ex; return(null); } }
public Entity.Persons.Person GetByEmail(string email) { try { Entity.Persons.Person person = null; var item = (from x in db.Credentials where x.Email == email select x).FirstOrDefault(); if (item != null) { person = new Entity.Persons.Person(item.BusinessEntityId); person.CurrentCredential = new Entity.Persons.Credential(item); } return(person); } catch (Exception ex) { lastException = ex; return(null); } }