public async Task <GetContributorByIdResponse> Handle(GetContributorByIdRequest request) { return(new GetContributorByIdResponse() { Contributor = ContributorApiModel.FromContributor(await _context.Contributors .Include(x => x.Tenant) .SingleAsync(x => x.Id == request.Id && x.Tenant.UniqueId == request.TenantUniqueId)) }); }
public async Task <GetContributorsResponse> Handle(GetContributorsRequest request) { var contributors = await _context.Contributors .Include(x => x.Tenant) .Where(x => x.Tenant.UniqueId == request.TenantUniqueId) .ToListAsync(); return(new GetContributorsResponse() { Contributors = contributors.Select(x => ContributorApiModel.FromContributor(x)).ToList() }); }