0

Details:

  1. In this below code _reportData.DistrictID and reportData.BeneficieryID values are "". But filter condition is not working. My requirement is to get matching values from the table.
  2. Below code is not filtering the data.

Below is the code to retrieve filtered data

    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;
        }
Guru Stron
  • 102,774
  • 10
  • 95
  • 132
Sneha
  • 428
  • 4
  • 10

1 Answers1

0

Are you trying to filter the Beneficiery with the BeneficieryID?

I observed that one of the line says b.Name.Contains(_reportData.BeneficieryID). Instead, are you trying to refer to b.Beneficiery.Contains(_reportData.BeneficieryID)?

WWW
  • 63
  • 5