/// <summary>
 /// Creates an HTML hyperlink that links to the page represented by the <paramref name="model"/>.
 /// </summary>
 /// <param name="htmlHelper">
 /// The instance of <see cref="T:HtmlHelper"/> that creates the hyperlink.
 /// </param>
 /// <param name="model">
 /// The <see cref="T:IPageLinkModel"/> that represents the page to be linked.
 /// </param>
 /// <returns>
 /// The HTML hyperlink.
 /// </returns>
 public static MvcHtmlString PageLink(this HtmlHelper htmlHelper, IPageLinkModel model)
 {
     if (null == model) throw new ArgumentNullException("model");
     if (null == htmlHelper) throw new ArgumentNullException("htmlHelper");
     var actionName = Paginated.GetActionName(htmlHelper);
     var routeValues = Paginated.GetRouteValues(model);
     return htmlHelper.ActionLink(model.LinkText, actionName, routeValues);
 }
Exemple #2
0
        public static RouteValueDictionary GetRouteValues(IPageLinkModel model)
        {
            if (null == model) throw new ArgumentNullException("model");

            var request = model.Request;
            if (request == null) throw new ArgumentException("The request is null.");

            return request.GetRouteValues(model.LinkPage);
        }
Exemple #3
0
        /// <summary>
        /// Creates a URL that can be used to access the page represented
        /// by the instance of <see cref="T:IPageLinkModel"/>.
        /// </summary>
        /// <param name="urlHelper">
        /// The <see cref="T:UrlHelper"/> instance that this method extends.
        /// </param>
        /// <param name="model">
        /// The <see cref="T:IPageLinkModel"/> for which the URL is to be created.
        /// </param>
        /// <returns>
        /// A URL that can be used to access the page represented by the given <paramref name="model"/>.
        /// </returns>
        public static string Page(this UrlHelper urlHelper, IPageLinkModel model)
        {
            if (null == urlHelper)
            {
                throw new ArgumentNullException("urlHelper");
            }
            var actionName  = Paginated.GetActionName(urlHelper);
            var routeValues = Paginated.GetRouteValues(model);

            return(urlHelper.Action(actionName, routeValues));
        }
Exemple #4
0
        /// <summary>
        /// Creates an HTML hyperlink that links to the page represented by the <paramref name="model"/>.
        /// </summary>
        /// <param name="htmlHelper">
        /// The instance of <see cref="T:HtmlHelper"/> that creates the hyperlink.
        /// </param>
        /// <param name="model">
        /// The <see cref="T:IPageLinkModel"/> that represents the page to be linked.
        /// </param>
        /// <returns>
        /// The HTML hyperlink.
        /// </returns>
        public static MvcHtmlString PageLink(this HtmlHelper htmlHelper, IPageLinkModel model)
        {
            if (null == model)
            {
                throw new ArgumentNullException("model");
            }
            if (null == htmlHelper)
            {
                throw new ArgumentNullException("htmlHelper");
            }
            var actionName  = Paginated.GetActionName(htmlHelper);
            var routeValues = Paginated.GetRouteValues(model);

            return(htmlHelper.ActionLink(model.LinkText, actionName, routeValues));
        }
Exemple #5
0
        public static RouteValueDictionary GetRouteValues(IPageLinkModel model)
        {
            if (null == model)
            {
                throw new ArgumentNullException("model");
            }

            var request = model.Request;

            if (request == null)
            {
                throw new ArgumentException("The request is null.");
            }

            return(request.GetRouteValues(model.LinkPage));
        }