阅读背景:

在Linq中使用where子句作为集合获取集合

来源:互联网 

Here is my service method:

这是我的服务方法:

 public List<RelatedInvoiceData> GetRelatedInvoices(InvoiceSearch invoiceSearchFilters)
 {
   List<InvoiceInfoView> invoices = _wiseStepDbContext.InvoiceInfoView.Where(i => i.RecruiterCompanyId == _securityManager.CurrentRecruiterCompanyId).ToList();

   List<RelatedInvoiceData> relatedInvoiceViewCollection = GetRelatedInvoiceCollection(invoices);

   if (invoiceSearchFilters.CustomerId > 0)
   {
        relatedInvoiceViewCollection = relatedInvoiceViewCollection.Where(i => i.CustomerId == invoiceSearchFilters.CustomerId).ToList();
   }

   if (invoiceSearchFilters.VendorId > 0)
   {
        relatedInvoiceViewCollection = relatedInvoiceViewCollection.Where(i => i.VendorId == invoiceSearchFilters.VendorId).ToList();
   }

   return relatedInvoiceViewCollection;
}
 publi



你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: