0

Cannot Convert From ElasticCoreWebApi.Controllers.AcquirerController.AcquirerReportParameters to ElasticCoreWebApi.BLL.ElasticSettledTranaction.AcquirerReportParameter

ElasticCoreWebApi has Reference of ElasticCoreWebApi.BLL operation

ElasticCoreWebApi.AcquirerController has the class

   public class AcquiringReportParameters
        {
            public string reportname { get; set; }
            public int merchantId { get; set; }
            public string branchCodes { get; set; }
            public string fromDate { get; set; }
            public string toDate { get; set; }
            public string merchantName { get; set; }
            public string batchNo { get; set; }
            public string terminalId { get; set; }
            public string merchantNumber { get; set; }
            public string merchantBranchName { get; set; }
            public string dRCR { get; set; }
            public string mID { get; set; }
            public int pageSize { get; set; }
            public int pageIndex { get; set; }
        }

In Acquirer controller i am calling the second method and passing the parameters like this i have data mapped in the class

    AcquiringReportParameters parameters = new AcquiringReportParameters();

    ElasticSettlementTransactionBLL ElasticBLL = new ElasticSettlementTransactionBLL();
 
    *var test = await ElasticBLL.GetSettledParameterTransaction(parameters);*
*I am getting error here in the parameter*

ElasticCoreWebApi.BLL.ElasticSettledTransaction.cs has the class

  public class AcquiringReportParameters
        {
            public string reportname { get; set; }
            public int merchantId { get; set; }
            public string branchCodes { get; set; }
            public string fromDate { get; set; }
            public string toDate { get; set; }
            public string merchantName { get; set; }
            public string batchNo { get; set; }
            public string terminalId { get; set; }
            public string merchantNumber { get; set; }
            public string merchantBranchName { get; set; }
            public string dRCR { get; set; }
            public string mID { get; set; }
            public int pageSize { get; set; }
            public int pageIndex { get; set; }
        }

Here is the method which i was calling

        public async Task<string> GetSettledParameterTransaction(AcquiringReportParameters parameters)
sticky bit
  • 36,626
  • 12
  • 31
  • 42
Asad
  • 617
  • 2
  • 8
  • 23
  • 1
    They are different types? `new ElasticCoreWebApi.Controllers.AcquirerController.AcquirerReportParameters.AcquiringReportParameters()` – TheGeneral Aug 05 '20 at 09:59
  • If A and B are different types, then converting A to B require some [additional work](https://stackoverflow.com/q/42622615/1997232). – Sinatr Aug 05 '20 at 09:59
  • no both are class and same as that of the one class to the other class – Asad Aug 05 '20 at 10:00
  • 3
    If they are *look same*, they are still different types if defined in different places. – Sinatr Aug 05 '20 at 10:01
  • 4
    Even if they are identical in every way, they are still two independent classes. You will need to map one to the other, or have one declaration and some sort of shared library ? – cookee89 Aug 05 '20 at 10:02
  • then what can i do?? – Asad Aug 05 '20 at 10:02
  • 1
    Simply read comments above. Carefully. They contain answers. – Sinatr Aug 05 '20 at 10:04
  • The fastest (but not the best) solution to make this code work is to replace the type of the expected parameter in your method `GetSettledParameterTransaction` to `dynamic`. – Erik T. Aug 05 '20 at 10:08

0 Answers0