0

I want to know how can I access virtual actionresult, since I haven't seen so far this type of actionresults. I've read little bit and I can see that is related to t4mvc but I'm not sure how can I access it.

This is what I have, ScheduleController, which has this actionresult for example:

[Authorize]
public virtual ActionResult AdminSport(int sportId)
{
    Sport sport = _rep.GetSport(sportId);
    if(sport == null)
    {
        return this.ViewNotFound();
    }
    if(!User.IsScheduleAdmin(sport))
    {
        return this.ViewNotAuthorized();
    }
    var ret = _rep.ListScheduleEntriesForAD(sport);
    return View(ret);
}

Then, the only other instance of that controller I found was in T4MVC, and this is whats in that file:

[NonAction]
partial void AdminSportOverride(T4MVC_System_Web_Mvc_ActionResult callInfo, int sportId);

[NonAction]
public override System.Web.Mvc.ActionResult AdminSport(int sportId)
{
    var callInfo = new T4MVC_System_Web_Mvc_ActionResult(Area, Name, ActionNames.AdminSport);
    ModelUnbinderHelpers.AddRouteValues(callInfo.RouteValueDictionary, "sportId", sportId);
    AdminSportOverride(callInfo, sportId);
    return callInfo;
}

My question is how can I access that specific action, for example if I type in the browser: /Schedule/AdminSport I'm getting an error.

Any idea what/how do I need to fix this?

Craig W.
  • 17,838
  • 6
  • 49
  • 82
Laziale
  • 7,965
  • 46
  • 146
  • 262
  • What error are you getting? You should probably show your route definitions(s). Based on what T4MVC generated it looks like `sportId` is not optional -- so hitting an URL/URI that does not specify this parameter will not match the controller action shown. – David Tansey May 07 '15 at 21:17
  • Do you get a different result if you use `Schedule/AdminSport?sportId=1` – David Tansey May 07 '15 at 21:21
  • @DavidTansey same answer. – Laziale May 07 '15 at 21:38

0 Answers0