Пример #1
0
        public static string Show <TShowModel>(this UrlHelper helper,
                                               TShowModel showModel) where TShowModel : class
        {
            var routeValues = ModelRouteValuesProvider.GetRouteValues(showModel);

            return(Action(helper,
                          ActionNames.Show,
                          showModel,
                          routeValues));
        }
Пример #2
0
        public static string Edit <TEditModel>(this UrlHelper helper,
                                               TEditModel editModel) where TEditModel : class
        {
            var routeValues = ModelRouteValuesProvider.GetRouteValues(editModel);

            return(Action(helper,
                          ActionNames.Edit,
                          editModel,
                          routeValues));
        }
Пример #3
0
        public static MvcForm BeginEditForm <TEditModel>(this HtmlHelper helper,
                                                         TEditModel editModel,
                                                         FormMethod method,
                                                         object htmlAttributes = null) where TEditModel : class
        {
            var routeValues    = ModelRouteValuesProvider.GetRouteValues(editModel);
            var controllerName = HelperUtil.GetControllerName(editModel);

            return(helper.BeginForm(ActionNames.Edit,
                                    controllerName,
                                    routeValues,
                                    method,
                                    htmlAttributes));
        }
Пример #4
0
        public static MvcHtmlString ShowLink <TShowModel>(this HtmlHelper helper,
                                                          TShowModel showModel,
                                                          string linkText,
                                                          object htmlAttributes = null) where TShowModel : class
        {
            var routeValues = ModelRouteValuesProvider.GetRouteValues(showModel);

            return(ActionLink(helper,
                              linkText,
                              ActionNames.Show,
                              showModel,
                              routeValues,
                              htmlAttributes));
        }
Пример #5
0
        public static MvcHtmlString EditLink <TEditModel>(this HtmlHelper helper,
                                                          TEditModel editModel,
                                                          string linkText,
                                                          object htmlAttributes = null) where TEditModel : class
        {
            var routeValues = ModelRouteValuesProvider.GetRouteValues(editModel);

            return(ActionLink(helper,
                              linkText,
                              ActionNames.Edit,
                              editModel,
                              routeValues,
                              htmlAttributes));
        }