Is there stratifitsirovannykh way to reuse Razor code in ASP.Net MVC?

Hello!
In my project I have a partial action (ActionResult PartialAction(){ return PartialView(); }) and the submission of the Razor that I use in other views using the call type:
Html.RenderAction("ActionName","Controller",new { x = 1, y=2, z=3})
Html.RenderPartial("~/Views/Controller/ViewName",new { a=10, b=20, c=30})


But this approach I don't really like: first, it is impossible to use IntelliSense, and you need to look for the right method and all its parameters, and secondly, it is difficult to find all the places is called a specific method (Shift+F12 does not work).

How appropriate, correct and not harmful to do for such a partial view and child action wrapper in the form of extensions like this:

public static class HelperExtensions
{
 RenderABC public static MvcHtmlString(this HtmlHelper self, int a,int b, int c)
{
 return self.Partial("~/Views/Controller/ViewName",new { a, b, c});
}
}

Accordingly, in any view instead
Html.RenderPartial("~/Views/Controller/ViewName",new { a=10, b=20, c=30})

write
Html.RenderABC(10,20,30)
and get extra convenience

Another question: this approach normal, or is this a Bicycle, a crutch, anti-template, etc.
Maybe there is already a neat way to design a reusable Razor code?
March 20th 20 at 11:20
0 answer

Find more questions by tags ASP.NET