public async Task <GetIdeaByIdResponse> Handle(GetIdeaByIdRequest request) { return(new GetIdeaByIdResponse() { Idea = IdeaApiModel.FromIdea(await _context.Ideas .Include(x => x.User) .Include(x => x.Votes) .Include(x => x.IdeaDigitalAssets) .Include(x => x.IdeaLinks) .SingleAsync(x => x.Id == request.Id && x.TenantId == request.TenantId)) }); }
public async Task <GetIdeasResponse> Handle(GetIdeasRequest request) { var ideas = await _context.Ideas .Include(x => x.User) .Include(x => x.Votes) .Include(x => x.IdeaDigitalAssets) .Include(x => x.IdeaLinks) .Where(x => x.TenantId == request.TenantId) .ToListAsync(); return(new GetIdeasResponse() { Ideas = ideas.Select(x => IdeaApiModel.FromIdea(x)).ToList() }); }