详细内容:
1.在下面的代码中,_reportData.DistrictID
和reportData.BeneficieryID
的值是""
。但过滤条件不起作用。我的要求是从表中获取匹配的值。
1.下面的代码没有过滤数据。
下面是检索筛选数据的代码
public async Task<IEnumerable<BeneficieryMasterExcelUpload>> GetBeneficieryReports(ReportsDataSearch _reportData)
{
IEnumerable<BeneficieryMasterExcelUpload> beneficieryList = _appDBContext.BeneficieryMasterExcelUpload;
try
{
var beneficieryList = (from b in _appDBContext.BeneficieryMasterExcelUpload
where b.Financial_Year.Contains(_reportData.FinancialYear)
|| b.District.Contains(_reportData.DistrictID) ||
b.Name.Contains(_reportData.BeneficieryID) ||
b.District.Contains(_reportData.DistrictID) ||
b.Taluk.Contains(_reportData.TalukID) ||
b.Village.StartsWith(_reportData.VillageID) ||
b.SchemeName.Contains(_reportData.SchemeMasterID)
select new BeneficieryMasterExcelUpload()
{
BeneficieryID = b.BeneficieryID,
Name = b.Name,
SchemeName = b.SchemeName,
BusinessName = b.BusinessName,
District = b.District,
Taluk = b.Taluk,
Village = b.Village,
Constitunency_num = b.Constitunency_num,
BankName = b.BankName,
Financial_Year = b.Financial_Year,
Religion = b.Religion,
}).ToList();
return beneficieryList;
}
catch (Exception ex)
{
return null;
}
字符串
1条答案
按热度按时间fzwojiic1#
您是否试图使用
BeneficieryID
过滤Beneficiery
?我注意到其中一行写着
b.Name.Contains(_reportData.BeneficieryID)
。相反,您是否试图引用b.Beneficiery.Contains(_reportData.BeneficieryID)
?