public ContactWithAddressDto GetContactWithAddressDto(Guid id) { using (var context = new ContactAggregateContext()) { Contact c = context.Contacts.Find(id); return(ContactWithAddressDto.Create(c.Id, c.Name, c.PrimaryAddress, c.Source)); } }
// GET api/<controller>/5 public Address GetPrimaryAddressForContact(Guid id) { using (var context = new ContactAggregateContext()) { return(context.Contacts.Find(id).PrimaryAddress); } }
// GET api/<controller> public IEnumerable <Contact> Get() { using (var context = new ContactAggregateContext()) { return(context.Contacts.ToList()); } }