Click here to Skip to main content
16,023,103 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Heres my code...

public ActionResult Create(int ReceiptId,PaymentPaidViewModel.detail details)
{
PaymentPaidViewModel.detail details = new PaymentPaidViewModel.detail();

if (details.idSelected == false)
{
var result = PaymentPaidViewModel.TotaltobePaid(ReceiptId);
return View(result);
}

else if (details.idSelected == true)
{ ----- }



this is not working, i think because when i do the first post only the receiptId is sent
Posted

1 solution

Try this code.

C#
public ActionResult Create(int ReceiptId,PaymentPaidViewModel.detail details)
 {
                if(details != null)
                { 
                    if (details.idSelected == false)
                    {
                        var result = PaymentPaidViewModel.TotaltobePaid(ReceiptId);
                        return View(result);
                    }
 
                    else if (details.idSelected == true)
                    { ----- }
                }
                else
                {
                        return View(ReceiptId);
                }
}
 
Share this answer
 
Comments
FirdousNasreen 17-Jul-13 4:15am    
I have the same controller for two different posts, for the first time it should take int ReceiptId as parameter and second time it should take model as a parameter.
ArunRajendra 17-Jul-13 4:29am    
Yes. But its not possible to do that. Thats why i am setting the priority by looking at PaymentPaidViewModel.detail first and use it if its available. If you want Receiptid to be priority then just change condition to if(ReceiptId==0). If you want to pass Null then change the paramater to int? ReceiptId and check to if(ReceiptId==null).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900