예제 #1
0
 public async Task <GetVendorByIdResponse> Handle(GetVendorByIdRequest request)
 {
     return(new GetVendorByIdResponse()
     {
         Vendor = VendorApiModel.FromVendor(await _context.Vendors
                                            .Include(x => x.VendorDocuments)
                                            .Include("VendorDocuments.Document")
                                            .Include(x => x.VendorSelectionCriterion)
                                            .Include("VendorSelectionCriterion.SelectionCriteria")
                                            .Include(x => x.Contacts)
                                            .SingleAsync(x => x.Id == request.Id && x.TenantId == request.TenantId))
     });
 }
예제 #2
0
            public async Task <GetVendorsResponse> Handle(GetVendorsRequest request)
            {
                var vendors = await _context.Vendors
                              .Include(x => x.VendorDocuments)
                              .Include("VendorDocuments.Document")
                              .Include(x => x.VendorSelectionCriterion)
                              .Include("VendorSelectionCriterion.SelectionCriteria")
                              .Include(x => x.Contacts)
                              .Where(x => x.TenantId == request.TenantId)
                              .ToListAsync();

                return(new GetVendorsResponse()
                {
                    Vendors = vendors.Select(x => VendorApiModel.FromVendor(x)).ToList()
                });
            }