public async Task <List <DAL.App.DTO.Contact> > AllForUserAsync(int userId) { return(await RepositoryDbSet .Include(c => c.ContactType) .ThenInclude(m => m.ContactTypeValue) .ThenInclude(t => t.Translations) .Include(c => c.Person) .Where(c => c.Person.AppUserId == userId) .Select(e => ContactMapper.MapFromDomain(e)).ToListAsync()); }
public async Task <DAL.App.DTO.Contact> FindForUserAsync(int id, int userId) { var contact = await RepositoryDbSet .Include(c => c.ContactType) .ThenInclude(m => m.ContactTypeValue) .ThenInclude(t => t.Translations) .Include(c => c.Person) .FirstOrDefaultAsync(m => m.Id == id && m.Person.AppUserId == userId); return(ContactMapper.MapFromDomain(contact)); }