src/ZKEACMS/Extend/RouteDataExtend.cs

(开头部分) 4KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

/* http://www.zkea.net/ 
 * Copyright (c) ZKEASOFT. All rights reserved. 
 * http://www.zkea.net/licenses */

using Easy.Extend;
using Microsoft.AspNetCore.Routing;
using ZKEACMS.Article.Models;
using ZKEACMS.Product.Models;

namespace ZKEACMS
{
    public static class RouteDataExtend
    {
        public static string GetPath(this RouteData routeData)
        {
            const string defaultPath = "/";
            string path = defaultPath;
            if (routeData.Values.ContainsKey(StringKeys.RouteValue_Path) && routeData.Values[StringKeys.RouteValue_Path] != null)
            {
                path = routeData.Values[StringKeys.RouteValue_Path].ToString();
                if (path.EndsWith("/") && path.Length > 1)
                {
                    return path.Substring(0, path.Length - 1);
                }
            }
            return path;
        }
        public static void SetPost(this RouteValueDictionary routeValue, int post)
        {
            routeValue.TryAdd(StringKeys.RouteValue_Post, post);
        }
        public static int GetPost(this RouteData routeData)
        {
            object post;
            if (routeData.Values.TryGetValue(StringKeys.RouteValue_Post, out post))
            {
                return (int)post;
            }
            return 0;
        }
        public static void SetCategory(this RouteValueDictionary routeValue, int category)
        {
            routeValue.TryAdd(StringKeys.RouteValue_Category, category);
        }
        public static int GetCategory(this RouteData routeData)
        {
            object post;
            if (routeData.Values.TryGetValue(StringKeys.RouteValue_Category, out post))
            {
                return (int)post;
            }
            return 0;
        }
        public static void SetPage(this RouteValueDictionary routeValue, int page)
        {
            routeValue.TryAdd(StringKeys.RouteValue_Page, page);
        }
        public static int GetPage(this RouteData routeData)
        {
            object page;
后面还有 77 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。