Last post Dec 23, 2018 05:07 AM by jafferpg
Dec 20, 2018 12:58 PM|jafferpg|LINK
How to add method list value inside the loop in the class.
public TransactionSearchResponse ReportData(Transsearchdata search, string language)
TransactionSearchResponse response = new Models.TransactionSearchResponse();
response.Transactions = new List<Models.transresponse>();
response.ResponseCode = 0
response.ResponseDescription = "Processed successfully"
if (response.TotalCountRows > 299)
for (int i = 300; i <= response.TotalCountRows; i++)
search.firstvalue = i;
if ((i + 299) <= response.TotalCountRows)
search.lastvalue = i + 299;
search.lastvalue = Convert.ToInt32(response.TotalCountRows);
TransactionSearchResponse responseOfSingleSplit = SplitData(search, messageID, response);
i = i + 299;
// I need to add the Splitdata list value in return statment each time when the loop running
response.transaction.add() // ???????????? how to add the transactions in the response
Thanks in advance
Dec 20, 2018 08:50 PM|PaulTheSmith|LINK
I probably haven't understood your question as you already have the add method in the code but you have put a line through it. Can you explain more about your problem?
Dec 21, 2018 09:19 AM|PatriceSc|LINK
According to your earlier code it seems it should be :
response.Transactions.Add(???); // your intent is to copy values coming from responseOfSingleSplit.Transactions ?
Your code is confusing because you just created a response object from scratch and it seems you expect it to already have data (testing response.TotalCountRows). It almost feel your intent is to copy a TransactionSearchResponse to another one while
you could perhaps just returrn the one you got from SplitData directly ????
Dec 23, 2018 05:07 AM|jafferpg|LINK
Thanks for your response PaulThesmith and patrice.
Yes, may be the way i posted the coding is not understandable. am extermely sorry for that.
I done by create another list class and concat the list into existing one. Now its working fine
response.ReportTransactions = response.ReportTransactions.Concat(response.Transactions).ToList();
Once again Thanks for your response!!