Here is the problem. I am getting IEnumerable from ViewPage and when I tried it to convert List it is showing me error like:
'System.Collections.Generic.IEnumerable<Pax_Detail>
' does not contain
a definition for 'ToList' and no extension method 'ToList' accepting a
first argument of type
'System.Collections.Generic.IEnumerable<Pax_Detail>
' could be found
(are you missing a using directive or an assembly reference?)
Here is my controller code:
[HttpPost]
public ActionResult Edit_Booking(Booking model, IEnumerable<Pax_Detail> pax)
{
List<Pax_Detail> paxList = new List<Pax_Detail>();
paxList = pax.ToList(); //getting error here
BookingDL.Update_Booking(model, paxList);
return View();
}
I have applied same logic on another controller. And it is working fine. I don't know what problem it has. I have already clean, rebuild project and also restarted my laptop(though it was needed).
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…