public IList<Models.Person> Get() { using (var context = new EFContext()) { var query = from x in context.People select x; var list = query.ToList<SQLServerRepositories.Database.Person>(); var people = _mapper.Map<List<Models.Person>>(list); return people; } }
public Models.Person GetById(int id) { using (var context = new EFContext()) { var query = from x in context.People where x.ID == id select x; if (query.Count() == 1) { var result = query.SingleOrDefault(); var person = _mapper.Map<Models.Person>(result); return person; } return new Models.Person(); } }