Reputation: 1601
Right now I'm rewriting some code, but I also want to use existing code as a placeholder. I have a "Reference" controller that houses all of the new code and a "References" controller that houses the old code.
All I want to do is simply return a PartialViewResult from my old References controller from my Reference controller. I tried doing this:
public PartialViewResult ResolveView(int type)
{
//Other code
if (type == (int)ReferenceType.Participant) return ParticipantView();
//return default partial view
...
}
//Called from ResolveView
private PartialViewResult ParticipantView()
{
return RedirectToAction("ParticipantsView", "References");
}
Here's what I have for my old controller method:
public PartialViewResult ParticipantsView()
{
var viewmodel = new ParticipantCreateViewModel
{
Participant = new ParticipantViewModel(),
Person = new ParticipantPersonViewModel(),
Types = ReferenceService.GetData<ParticipantType>(),
};
return PartialView("_ParticipantsView");
}
I'm currently getting an error: Cannot implicitly convert type 'System.Web.Mvc.RedirectToRouteResult' to 'System.Web.Mvc.PartialViewResult'
What do I need to do to get it to return my PartialViewResult from my other controller?
Upvotes: 1
Views: 2876
Reputation: 82893
Change the method signature to return ActionResult
private ActionResult ParticipantsView()
{
return RedirectToAction("ParticipantsView", "References");
}
Upvotes: 2