Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static class ViewModelCaller<TController> where TController : Controller
- {
- public static ViewResult FromVm<TVm>() where TVm : ViewModelEx
- {
- var viewModelType = typeof(TVm);
- var controllerType = typeof(TController);
- var result = Controller.Action(controllerType.Name, viewModelType.Name).Result as ViewResult;
- return result;
- }
- public static ViewResult FromVm<TVm, TC>(object model) where TVm : ViewModelEx where TC : Controller
- {
- var type = typeof(TVm);
- var controllerType = typeof(TController);
- var result = Controller.Action(controllerType.Name, type.Name, new { model }).Result as ViewResult;
- return result;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement