Hi Guys
I was a bit surprised a few minutes ago when I tried to overload an Action in one of my Controllers
I had
public ActionResult Get()
{
return PartialView(/*return all things*/);
}
I added
public ActionResult Get(int id)
{
return PartialView(/*return 1 thing*/);
}
.... and all of a sudden neither were working
I fixed the issue by making 'id' nullable and getting rid of the other two methods
public ActionResult Get(int? id)
{
if (id.HasValue)
return PartialView(/*return 1 thing*/);
else
return PartialView(/*return everything*/);
}
and it worked, but my code just got a little bit ugly!
Any comments or suggestions? Do I have to live with this blemish on my Controllers?
Thanks
Dave