1

Can I render a url without query parameters with T4MVC without using nullable ints?

public virtual ActionResult GetSchoolsForDistrict(int districtId)
        {
            return Json(_schoolsService.GetSchoolsByDistrict(districtId.Value), JsonRequestBehavior.AllowGet);
        }
Mike Flynn
  • 22,342
  • 54
  • 182
  • 341
  • Can you provide more details about what you're trying to do? I don't see the connection between what you're asking and the code snippet. – David Ebbo Apr 13 '12 at 21:41
  • The parameter above always has to be supplied when doing Html.ActionLink(MVC.Schools.GetSchoolsForDistrict(0), which appends districtId=0, but would like the link with the query string without using int? districtId. – Mike Flynn Apr 23 '12 at 16:50

1 Answers1

2

You should be able to call it without any parameters. e.g.

Html.ActionLink(MVC.Schools.GetSchoolsForDistrict())

This is because T4MVC always generates an overload with no parameters.

David Ebbo
  • 42,443
  • 8
  • 103
  • 117