public async Task <Response> Handle(Request request) { return(new Response() { Product = ProductApiModel.FromProduct(await _context.Products .Include(x => x.Tenant) .SingleAsync(x => x.Id == request.Id && x.Tenant.UniqueId == request.TenantUniqueId)) }); }
public async Task <Response> Handle(Request request) { var products = await _context.Products .Include(x => x.Tenant) .Where(x => x.Tenant.UniqueId == request.TenantUniqueId) .ToListAsync(); return(new Response() { Products = products.Select(x => ProductApiModel.FromProduct(x)).ToList() }); }