Пример #1
0
 public async Task <GetContactByIdResponse> Handle(GetContactByIdRequest request)
 {
     return(new GetContactByIdResponse()
     {
         Contact = ContactApiModel.FromContact(await _context.Contacts.SingleAsync(x => x.Id == request.Id && x.TenantId == request.TenantId))
     });
 }
            public async Task <GetContactsResponse> Handle(GetContactsRequest request)
            {
                var contacts = await _context.Contacts
                               .Where(x => x.TenantId == request.TenantId)
                               .ToListAsync();

                return(new GetContactsResponse()
                {
                    Contacts = contacts.Select(x => ContactApiModel.FromContact(x)).ToList()
                });
            }