mirror of
				https://github.com/nsnail/FreeSql.git
				synced 2025-11-04 09:15:27 +08:00 
			
		
		
		
	add admin
This commit is contained in:
		@@ -1,13 +1,40 @@
 | 
			
		||||
using System;
 | 
			
		||||
using FreeSql.Site.DAL.Helper;
 | 
			
		||||
using System;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.DAL
 | 
			
		||||
{
 | 
			
		||||
    public class Db
 | 
			
		||||
    public static class Db
 | 
			
		||||
    {
 | 
			
		||||
        
 | 
			
		||||
        public static IFreeSql mysql = new FreeSql.FreeSqlBuilder()
 | 
			
		||||
            .UseConnectionString(FreeSql.DataType.MySql, AppSettingsManager.Get("ConnectionStrings:DefaultDbContext"))
 | 
			
		||||
        .Build();
 | 
			
		||||
        public static System.Collections.Generic.Dictionary<string, IFreeSql> ConnectionPool = new System.Collections.Generic.Dictionary<string, IFreeSql>();
 | 
			
		||||
 | 
			
		||||
        private static string getConnectionString(string sDatabaseType)
 | 
			
		||||
        {
 | 
			
		||||
            return AppSettingsManager.Get($"DbContexts:{sDatabaseType}:ConnectionString");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        private static IFreeSql SelectDBType(string dbtype)
 | 
			
		||||
        {
 | 
			
		||||
            if (!ConnectionPool.ContainsKey(dbtype))
 | 
			
		||||
            {
 | 
			
		||||
                ConnectionPool.Add(dbtype, new FreeSql.FreeSqlBuilder()
 | 
			
		||||
                    .UseConnectionString(FreeSql.DataType.MySql, getConnectionString(dbtype))
 | 
			
		||||
                    .Build());
 | 
			
		||||
            }
 | 
			
		||||
            return ConnectionPool[dbtype];
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static IFreeSql DB(this DataBaseType t)
 | 
			
		||||
        {
 | 
			
		||||
            return SelectDBType(t.ToString());
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public enum DataBaseType
 | 
			
		||||
    {
 | 
			
		||||
        MySql,
 | 
			
		||||
        SqlServer,
 | 
			
		||||
        PostgreSQL,
 | 
			
		||||
        Oracle,
 | 
			
		||||
        Sqlite
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										68
									
								
								Examples/website/FreeSql.Site.DAL/DocumentCommentDAL.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								Examples/website/FreeSql.Site.DAL/DocumentCommentDAL.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
//using FreeSql.Site.Entity;
 | 
			
		||||
using FreeSql.Site.Entity;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq.Expressions;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.DAL
 | 
			
		||||
{
 | 
			
		||||
    public class DocumentCommentDAL
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 新增方法
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="model"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public long Insert(DocumentComment model)
 | 
			
		||||
        {
 | 
			
		||||
            return DataBaseType.MySql.DB().Insert<DocumentComment>(model).ExecuteIdentity();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 修改方法
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="model"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public bool Update(DocumentComment model)
 | 
			
		||||
        {
 | 
			
		||||
            return DataBaseType.MySql.DB().Update<DocumentComment>(model.ID).ExecuteUpdated().Count > 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 删除方法
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="id"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public bool Delete(long id)
 | 
			
		||||
        {
 | 
			
		||||
            return DataBaseType.MySql.DB().Delete<DocumentComment>(id).ExecuteDeleted().Count > 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 获取一条数据
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="where"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public DocumentComment GetByOne(Expression<Func<DocumentComment, bool>> where)
 | 
			
		||||
        {
 | 
			
		||||
            return DataBaseType.MySql.DB().Select<DocumentComment>()
 | 
			
		||||
                 .Where(where).ToOne();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询方法
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="where"></param>
 | 
			
		||||
        /// <param name="orderby"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public List<DocumentComment> Query(Expression<Func<DocumentComment, bool>> where,
 | 
			
		||||
            Expression<Func<DocumentComment, DocumentComment>> orderby = null)
 | 
			
		||||
        {
 | 
			
		||||
            var list = DataBaseType.MySql.DB().Select<DocumentComment>()
 | 
			
		||||
                .Where(where);
 | 
			
		||||
            if (orderby != null) list = list.OrderBy(b => b.CreateDt);
 | 
			
		||||
            return list.ToList();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -1,42 +1,89 @@
 | 
			
		||||
//using FreeSql.Site.Entity;
 | 
			
		||||
using FreeSql.Site.Entity;
 | 
			
		||||
using FreeSql.Site.Entity;
 | 
			
		||||
using FreeSql.Site.Entity.Common;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq.Expressions;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.DAL
 | 
			
		||||
{
 | 
			
		||||
    public class DocumentContentDAL
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 新增
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="model"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public long Insert(DocumentContent model)
 | 
			
		||||
        {
 | 
			
		||||
            return Db.mysql.Insert<DocumentContent>(model).ExecuteIdentity();
 | 
			
		||||
            return DataBaseType.MySql.DB().Insert<DocumentContent>(model).ExecuteIdentity();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 修改
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="model"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public bool Update(DocumentContent model)
 | 
			
		||||
        {
 | 
			
		||||
            return Db.mysql.Update<DocumentContent>(model.ID).ExecuteUpdated().Count > 0;
 | 
			
		||||
            return DataBaseType.MySql.DB().Update<DocumentContent>(model.ID).ExecuteUpdated().Count > 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 删除
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="id"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public bool Delete(long id)
 | 
			
		||||
        {
 | 
			
		||||
            return Db.mysql.Delete<DocumentContent>(id).ExecuteDeleted().Count > 0;
 | 
			
		||||
            return DataBaseType.MySql.DB().Delete<DocumentContent>(id).ExecuteDeleted().Count > 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 获取一条数据
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="where"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public DocumentContent GetByOne(Expression<Func<DocumentContent, bool>> where)
 | 
			
		||||
        {
 | 
			
		||||
            return Db.mysql.Select<DocumentContent>()
 | 
			
		||||
            return DataBaseType.MySql.DB().Select<DocumentContent>()
 | 
			
		||||
                 .Where(where).ToOne();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public List<DocumentContent> Query(Expression<Func<DocumentContent, bool>> where,
 | 
			
		||||
            Expression<Func<DocumentContent, DocumentContent>> orderby = null)
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 获取一条数据
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="where"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public long Count(Expression<Func<DocumentContent, bool>> where)
 | 
			
		||||
        {
 | 
			
		||||
            var list = Db.mysql.Select<DocumentContent>()
 | 
			
		||||
            return DataBaseType.MySql.DB().Select<DocumentContent>()
 | 
			
		||||
                 .Where(where).Count();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询功能
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="where"></param>
 | 
			
		||||
        /// <param name="orderby"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public (List<DocumentContent> list, long count) Query(Expression<Func<DocumentContent, bool>> where,
 | 
			
		||||
            Expression<Func<DocumentContent, DocumentContent>> orderby = null, PageInfo pageInfo = null)
 | 
			
		||||
        {
 | 
			
		||||
            //设置查询条件
 | 
			
		||||
            var list = DataBaseType.MySql.DB().Select<DocumentContent>()
 | 
			
		||||
                .Where(where);
 | 
			
		||||
 | 
			
		||||
            //设置排序
 | 
			
		||||
            if (orderby != null) list = list.OrderBy(b => b.CreateDt);
 | 
			
		||||
            return list.ToList();
 | 
			
		||||
 | 
			
		||||
            var count = list.Count();
 | 
			
		||||
            //设置分页操作
 | 
			
		||||
            if (pageInfo != null && pageInfo.IsPaging)
 | 
			
		||||
                list.Skip(pageInfo.PageIndex * pageInfo.PageSize).Limit(pageInfo.PageSize);
 | 
			
		||||
 | 
			
		||||
            //执行查询
 | 
			
		||||
            return (list.ToList(), count);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -9,25 +9,57 @@ namespace FreeSql.Site.DAL
 | 
			
		||||
{
 | 
			
		||||
    public class DocumentTypeDAL
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 新增方法
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="model"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public long Insert(DocumentType model)
 | 
			
		||||
        {
 | 
			
		||||
            return Db.mysql.Insert<DocumentType>(model).ExecuteIdentity();
 | 
			
		||||
            return DataBaseType.MySql.DB().Insert<DocumentType>(model).ExecuteIdentity();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 修改方法
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="model"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public bool Update(DocumentType model)
 | 
			
		||||
        {
 | 
			
		||||
            return Db.mysql.Update<DocumentType>(model.ID).ExecuteUpdated().Count > 0;
 | 
			
		||||
            return DataBaseType.MySql.DB().Update<DocumentType>(model.ID).ExecuteUpdated().Count > 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 删除方法
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="id"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public bool Delete(long id)
 | 
			
		||||
        {
 | 
			
		||||
            return Db.mysql.Delete<DocumentType>(id).ExecuteDeleted().Count > 0;
 | 
			
		||||
            return DataBaseType.MySql.DB().Delete<DocumentType>(id).ExecuteDeleted().Count > 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 获取一条数据
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="where"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public DocumentType GetByOne(Expression<Func<DocumentType, bool>> where)
 | 
			
		||||
        {
 | 
			
		||||
            return DataBaseType.MySql.DB().Select<DocumentType>()
 | 
			
		||||
                 .Where(where).ToOne();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询方法
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="where"></param>
 | 
			
		||||
        /// <param name="orderby"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public List<DocumentType> Query(Expression<Func<DocumentType, bool>> where,
 | 
			
		||||
            Expression<Func<DocumentType, DocumentType>> orderby = null)
 | 
			
		||||
        {
 | 
			
		||||
            var list = Db.mysql.Select<DocumentType>()
 | 
			
		||||
            var list = DataBaseType.MySql.DB().Select<DocumentType>()
 | 
			
		||||
                .Where(where);
 | 
			
		||||
            if (orderby != null) list = list.OrderBy(b => b.CreateDt);
 | 
			
		||||
            return list.ToList();
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										37
									
								
								Examples/website/FreeSql.Site.DAL/Helper/EnumHelper.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										37
									
								
								Examples/website/FreeSql.Site.DAL/Helper/EnumHelper.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,37 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.DAL.Helper
 | 
			
		||||
{
 | 
			
		||||
    public class EnumHelper
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 枚举类型转换为字符串
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <typeparam name="T"></typeparam>
 | 
			
		||||
        /// <param name="en"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public static string EnumConvertToString<T>(T en)
 | 
			
		||||
        {
 | 
			
		||||
            //方法一
 | 
			
		||||
            //return color.ToString();
 | 
			
		||||
 | 
			
		||||
            //方法二
 | 
			
		||||
            return Enum.GetName(en.GetType(), en);
 | 
			
		||||
        }
 | 
			
		||||
        public static  T StringConvertToEnum<T>(string str)
 | 
			
		||||
        {
 | 
			
		||||
            T result = default(T);
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                result = (T)Enum.Parse(typeof(T), str);
 | 
			
		||||
            }
 | 
			
		||||
            catch (Exception ex)
 | 
			
		||||
            {
 | 
			
		||||
                return result;
 | 
			
		||||
            }
 | 
			
		||||
            return result;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										68
									
								
								Examples/website/FreeSql.Site.DAL/TemplateExampleDAL.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										68
									
								
								Examples/website/FreeSql.Site.DAL/TemplateExampleDAL.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,68 @@
 | 
			
		||||
//using FreeSql.Site.Entity;
 | 
			
		||||
using FreeSql.Site.Entity;
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq.Expressions;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.DAL
 | 
			
		||||
{
 | 
			
		||||
    public class TemplateExampleDAL
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 新增方法
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="model"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public long Insert(TemplateExample model)
 | 
			
		||||
        {
 | 
			
		||||
            return DataBaseType.MySql.DB().Insert<TemplateExample>(model).ExecuteIdentity();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 修改方法
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="model"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public bool Update(TemplateExample model)
 | 
			
		||||
        {
 | 
			
		||||
            return DataBaseType.MySql.DB().Update<TemplateExample>(model.ID).ExecuteUpdated().Count > 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 删除方法
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="id"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public bool Delete(long id)
 | 
			
		||||
        {
 | 
			
		||||
            return DataBaseType.MySql.DB().Delete<TemplateExample>(id).ExecuteDeleted().Count > 0;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 获取一条数据
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="where"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public TemplateExample GetByOne(Expression<Func<TemplateExample, bool>> where)
 | 
			
		||||
        {
 | 
			
		||||
            return DataBaseType.MySql.DB().Select<TemplateExample>()
 | 
			
		||||
                 .Where(where).ToOne();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 查询方法
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        /// <param name="where"></param>
 | 
			
		||||
        /// <param name="orderby"></param>
 | 
			
		||||
        /// <returns></returns>
 | 
			
		||||
        public List<TemplateExample> Query(Expression<Func<TemplateExample, bool>> where,
 | 
			
		||||
            Expression<Func<TemplateExample, TemplateExample>> orderby = null)
 | 
			
		||||
        {
 | 
			
		||||
            var list = DataBaseType.MySql.DB().Select<TemplateExample>()
 | 
			
		||||
                .Where(where);
 | 
			
		||||
            if (orderby != null) list = list.OrderBy(b => b.CreateDt);
 | 
			
		||||
            return list.ToList();
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										34
									
								
								Examples/website/FreeSql.Site.Entity/Common/DataPage.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										34
									
								
								Examples/website/FreeSql.Site.Entity/Common/DataPage.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,34 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.Entity.Common
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 列表数据返回对象
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <typeparam name="T"></typeparam>
 | 
			
		||||
    public class DataPage<T>
 | 
			
		||||
        where T : class
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 返回成功与否
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string code { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 如果返回报错,具体报错内容
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string msg { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 总计记录行数
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public long count { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 返回具体的数据
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public List<T> data { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										43
									
								
								Examples/website/FreeSql.Site.Entity/Common/PageInfo.cs
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										43
									
								
								Examples/website/FreeSql.Site.Entity/Common/PageInfo.cs
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,43 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Text;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.Entity.Common
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 列表数据返回对象
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    /// <typeparam name="T"></typeparam>
 | 
			
		||||
    public class PageInfo
 | 
			
		||||
    {
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 排序字段
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string Order { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 页码
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public int PageIndex { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 页记录数
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public int PageSize { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 排序方式
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string Sort { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 总计数量
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public int Total { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 是否获取总数
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public bool IsPaging { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -4,6 +4,9 @@ using System;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.Entity
 | 
			
		||||
{
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 数据库实体
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public class DocumentContent
 | 
			
		||||
    {
 | 
			
		||||
        [Column(IsIdentity = true, IsPrimary = true)]
 | 
			
		||||
@@ -64,4 +67,12 @@ namespace FreeSql.Site.Entity
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string UpdateBy { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /// <summary>
 | 
			
		||||
    /// 返回实体内容
 | 
			
		||||
    /// </summary>
 | 
			
		||||
    public class DocumentContentView : DocumentContent
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -13,6 +13,11 @@ namespace FreeSql.Site.Entity
 | 
			
		||||
 | 
			
		||||
        public int? UpID { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 标签
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string Tag { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 状态
 | 
			
		||||
        /// </summary>
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,11 @@ namespace FreeSql.Site.Entity
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string TempateName { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 描述
 | 
			
		||||
        /// </summary>
 | 
			
		||||
        public string Describe { get; set; }
 | 
			
		||||
 | 
			
		||||
        /// <summary>
 | 
			
		||||
        /// 模板路径
 | 
			
		||||
        /// </summary>
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,13 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using Microsoft.AspNetCore.Mvc;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.UI.Admin.Common
 | 
			
		||||
{
 | 
			
		||||
    public class AdminBaseController : Controller
 | 
			
		||||
    {
 | 
			
		||||
      
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using FreeSql.Site.Entity;
 | 
			
		||||
using FreeSql.Site.UI.Admin.Common;
 | 
			
		||||
using FreeSql.Site.UI.Areas.BBS.Models;
 | 
			
		||||
using FreeSql.Site.UI.Controllers;
 | 
			
		||||
using Microsoft.AspNetCore.Mvc;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.UI.Areas.Admin.Controllers
 | 
			
		||||
{
 | 
			
		||||
    [Area("Admin")]
 | 
			
		||||
    public class BBSController : AdminBaseController
 | 
			
		||||
    {
 | 
			
		||||
        public IActionResult Index()
 | 
			
		||||
        {
 | 
			
		||||
            DocumentContent model = new DocumentContent();
 | 
			
		||||
            return View(model);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,117 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Linq.Expressions;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using FreeSql.Site.DAL;
 | 
			
		||||
using FreeSql.Site.Entity;
 | 
			
		||||
using FreeSql.Site.Entity.Common;
 | 
			
		||||
using FreeSql.Site.UI.Admin.Common;
 | 
			
		||||
using FreeSql.Site.UI.Areas.BBS.Models;
 | 
			
		||||
using FreeSql.Site.UI.Common;
 | 
			
		||||
using FreeSql.Site.UI.Controllers;
 | 
			
		||||
using Microsoft.AspNetCore.Http;
 | 
			
		||||
using Microsoft.AspNetCore.Mvc;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.UI.Areas.Admin.Controllers
 | 
			
		||||
{
 | 
			
		||||
    [Area("Admin")]
 | 
			
		||||
    public class DocumentController : AdminBaseController
 | 
			
		||||
    {
 | 
			
		||||
        public DocumentTypeDAL DocumentTypeDAL { get; set; }
 | 
			
		||||
 | 
			
		||||
        public DocumentContentDAL DocumentContentDAL { get; set; }
 | 
			
		||||
 | 
			
		||||
        public DocumentController()
 | 
			
		||||
        {
 | 
			
		||||
            this.DocumentTypeDAL = new DocumentTypeDAL();
 | 
			
		||||
            this.DocumentContentDAL = new DocumentContentDAL();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        public IActionResult Index()
 | 
			
		||||
        {
 | 
			
		||||
            DocumentContent model = new DocumentContent();
 | 
			
		||||
            return View(model);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #region 文档分类
 | 
			
		||||
        public IActionResult DocType()
 | 
			
		||||
        {
 | 
			
		||||
            DocumentType model = new DocumentType();
 | 
			
		||||
            return View(model);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion
 | 
			
		||||
 | 
			
		||||
        #region 文档内容
 | 
			
		||||
        public IActionResult DocContent()
 | 
			
		||||
        {
 | 
			
		||||
            DocumentContent model = new DocumentContent();
 | 
			
		||||
            return View(model);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [HttpGet]
 | 
			
		||||
        public IActionResult DocContentList(string searchContent, string seniorQueryJson, int page = 1, int limit = 10)
 | 
			
		||||
        {
 | 
			
		||||
            DocumentContent model = null;
 | 
			
		||||
            if (!string.IsNullOrWhiteSpace(seniorQueryJson))
 | 
			
		||||
            {
 | 
			
		||||
                model = Newtonsoft.Json.JsonConvert.DeserializeObject<DocumentContent>(seniorQueryJson);
 | 
			
		||||
            }
 | 
			
		||||
            Expression<Func<DocumentContent, bool>> predicate = i => 1 == 0;
 | 
			
		||||
            var searchPredicate = PredicateExtensions.True<DocumentContent>();
 | 
			
		||||
            if (model != null)
 | 
			
		||||
            {
 | 
			
		||||
                if (model.TypeID >= 0)
 | 
			
		||||
                    searchPredicate = searchPredicate.And(u => u.TypeID == model.TypeID);
 | 
			
		||||
 | 
			
		||||
                if (!string.IsNullOrEmpty(model.DocTitle))
 | 
			
		||||
                    searchPredicate = searchPredicate.And(u => u.DocTitle.IndexOf(model.DocTitle) != -1);
 | 
			
		||||
            }
 | 
			
		||||
            var contents = DocumentContentDAL.Query(searchPredicate);
 | 
			
		||||
 | 
			
		||||
            return Json(new DataPage<DocumentContent>
 | 
			
		||||
            {
 | 
			
		||||
                code = "0",
 | 
			
		||||
                msg = "",
 | 
			
		||||
                count = contents.count,
 | 
			
		||||
                data = contents.list
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // GET: Documents/Create
 | 
			
		||||
        public ActionResult DocContentCreate()
 | 
			
		||||
        {
 | 
			
		||||
 | 
			
		||||
            return View();
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // POST: Documents/Create
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        [ValidateAntiForgeryToken]
 | 
			
		||||
        public ActionResult DocContentCreate(IFormCollection collection)
 | 
			
		||||
        {
 | 
			
		||||
            try
 | 
			
		||||
            {
 | 
			
		||||
                // TODO: Add insert logic here
 | 
			
		||||
                return RedirectToAction(nameof(Index));
 | 
			
		||||
            }
 | 
			
		||||
            catch
 | 
			
		||||
            {
 | 
			
		||||
                return View();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        [HttpPost]
 | 
			
		||||
        [ValidateAntiForgeryToken]
 | 
			
		||||
        public ActionResult DocContentDelete(int id, IFormCollection collection)
 | 
			
		||||
        {
 | 
			
		||||
            bool flag = false;
 | 
			
		||||
            flag = DocumentContentDAL.Delete(id);
 | 
			
		||||
            return Json(flag);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        #endregion 
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using FreeSql.Site.Entity;
 | 
			
		||||
using FreeSql.Site.UI.Admin.Common;
 | 
			
		||||
using FreeSql.Site.UI.Areas.BBS.Models;
 | 
			
		||||
using FreeSql.Site.UI.Controllers;
 | 
			
		||||
using Microsoft.AspNetCore.Mvc;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.UI.Areas.Admin.Controllers
 | 
			
		||||
{
 | 
			
		||||
    [Area("Admin")]
 | 
			
		||||
    public class SystemController : AdminBaseController
 | 
			
		||||
    {
 | 
			
		||||
        public IActionResult Setting()
 | 
			
		||||
        {
 | 
			
		||||
            DocumentContent model = new DocumentContent();
 | 
			
		||||
            return View(model);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,23 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
using FreeSql.Site.Entity;
 | 
			
		||||
using FreeSql.Site.UI.Admin.Common;
 | 
			
		||||
using FreeSql.Site.UI.Areas.BBS.Models;
 | 
			
		||||
using FreeSql.Site.UI.Controllers;
 | 
			
		||||
using Microsoft.AspNetCore.Mvc;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.UI.Areas.Admin.Controllers
 | 
			
		||||
{
 | 
			
		||||
    [Area("Admin")]
 | 
			
		||||
    public class TemplateController : AdminBaseController
 | 
			
		||||
    {
 | 
			
		||||
        public IActionResult Index()
 | 
			
		||||
        {
 | 
			
		||||
            DocumentContent model = new DocumentContent();
 | 
			
		||||
            return View(model);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,14 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.UI.Areas.Admin.Models
 | 
			
		||||
{
 | 
			
		||||
    public class DocumentContentModel
 | 
			
		||||
    {
 | 
			
		||||
        public int OrderBy { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int ContentID { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,14 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.UI.Areas.Admin.Models
 | 
			
		||||
{
 | 
			
		||||
    public class DocumentTypeModel
 | 
			
		||||
    {
 | 
			
		||||
        public int OrderBy { get; set; }
 | 
			
		||||
 | 
			
		||||
        public int ContentID { get; set; }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -0,0 +1,91 @@
 | 
			
		||||
<!DOCTYPE html>
 | 
			
		||||
<html>
 | 
			
		||||
<head>
 | 
			
		||||
    <meta charset="utf-8" />
 | 
			
		||||
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
 | 
			
		||||
    <title>@ViewData["Title"] - FreeSql.Site.UI</title>
 | 
			
		||||
 | 
			
		||||
    <environment include="Development">
 | 
			
		||||
        <link href="~/layui/css/layui.css" rel="stylesheet" />
 | 
			
		||||
        <link rel="stylesheet" href="https://cdn.bootcss.com/highlight.js/9.11.0/styles/github.min.css" />
 | 
			
		||||
        <script src="~/lib/jquery/dist/jquery.js"></script>
 | 
			
		||||
        <script src="~/lib/bootstrap/dist/js/bootstrap.js"></script>
 | 
			
		||||
        <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
 | 
			
		||||
        <script src="https://cdn.bootcss.com/highlight.js/9.13.1/highlight.min.js"></script>
 | 
			
		||||
        <script src="~/layui/layui.js"></script>
 | 
			
		||||
    </environment>
 | 
			
		||||
    <environment exclude="Development">
 | 
			
		||||
        <link rel="stylesheet" href="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/css/bootstrap.min.css"
 | 
			
		||||
              asp-fallback-href="~/lib/bootstrap/dist/css/bootstrap.min.css"
 | 
			
		||||
              asp-fallback-test-class="sr-only" asp-fallback-test-property="position" asp-fallback-test-value="absolute" />
 | 
			
		||||
    </environment>
 | 
			
		||||
</head>
 | 
			
		||||
<body class="layui-layout-body" id="LAY_home" style="background-color: #fff;" data-date="12-27">
 | 
			
		||||
    <div class="layui-layout layui-layout-admin">
 | 
			
		||||
        <div class="layui-header">
 | 
			
		||||
            <div class="layui-logo"><span style="font-size:25px; letter-spacing:1px; color:#fff;">FreeSql</span></div>
 | 
			
		||||
            <!-- 头部区域(可配合layui已有的水平导航) -->
 | 
			
		||||
            <ul class="layui-nav layui-layout-left">
 | 
			
		||||
                <li class="layui-nav-item active"><a href="/Admin/Document" target="_self">文档管理</a></li>
 | 
			
		||||
                <li class="layui-nav-item"><a href="/Admin/BBS" target="_self">论坛管理</a></li>
 | 
			
		||||
                <li class="layui-nav-item"><a href="/Admin/Template" target="_self">模板管理</a></li>
 | 
			
		||||
            </ul>
 | 
			
		||||
            <ul class="layui-nav layui-layout-right">
 | 
			
		||||
                <li class="layui-nav-item">
 | 
			
		||||
                    <a href="javascript:;">
 | 
			
		||||
                        <img src="#" class="layui-nav-img">
 | 
			
		||||
                        FreeSql
 | 
			
		||||
                    </a>
 | 
			
		||||
                    <dl class="layui-nav-child">
 | 
			
		||||
                        <dd><a href="">基本资料</a></dd>
 | 
			
		||||
                        <dd><a href="">安全设置</a></dd>
 | 
			
		||||
                    </dl>
 | 
			
		||||
                </li>
 | 
			
		||||
                <li class="layui-nav-item"><a href="">退出</a></li>
 | 
			
		||||
            </ul>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <partial name="_CookieConsentPartial" />
 | 
			
		||||
        @RenderBody()
 | 
			
		||||
 | 
			
		||||
        <div class="layui-footer">
 | 
			
		||||
            <!-- 底部固定区域 -->
 | 
			
		||||
            © FreeSql.com - 底部固定区域
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
    <environment include="Development">
 | 
			
		||||
        @*<script src="~/js/site.js" asp-append-version="true"></script>*@
 | 
			
		||||
        <script>
 | 
			
		||||
            layui.config({
 | 
			
		||||
                base: '/layui/lay/modules/'
 | 
			
		||||
                , version: '31111'
 | 
			
		||||
            }).use('global');
 | 
			
		||||
 | 
			
		||||
            window.global = {
 | 
			
		||||
                preview: function () {
 | 
			
		||||
                    var preview = document.getElementById('LAY_preview');
 | 
			
		||||
                    return preview ? preview.innerHTML : '';
 | 
			
		||||
                }()
 | 
			
		||||
            };
 | 
			
		||||
        </script>
 | 
			
		||||
    </environment>
 | 
			
		||||
    <environment exclude="Development">
 | 
			
		||||
        <script src="https://ajax.aspnetcdn.com/ajax/jquery/jquery-3.3.1.min.js"
 | 
			
		||||
                asp-fallback-src="~/lib/jquery/dist/jquery.min.js"
 | 
			
		||||
                asp-fallback-test="window.jQuery"
 | 
			
		||||
                crossorigin="anonymous"
 | 
			
		||||
                integrity="sha384-tsQFqpEReu7ZLhBV2VZlAu7zcOV+rXbYlF2cqB8txI/8aZajjp4Bqd+V6D5IgvKT">
 | 
			
		||||
        </script>
 | 
			
		||||
        <script src="https://ajax.aspnetcdn.com/ajax/bootstrap/3.3.7/bootstrap.min.js"
 | 
			
		||||
                asp-fallback-src="~/lib/bootstrap/dist/js/bootstrap.min.js"
 | 
			
		||||
                asp-fallback-test="window.jQuery && window.jQuery.fn && window.jQuery.fn.modal"
 | 
			
		||||
                crossorigin="anonymous"
 | 
			
		||||
                integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa">
 | 
			
		||||
        </script>
 | 
			
		||||
        <script src="~/js/site.min.js" asp-append-version="true"></script>
 | 
			
		||||
    </environment>
 | 
			
		||||
 | 
			
		||||
    @RenderSection("Scripts", required: false)
 | 
			
		||||
</body>
 | 
			
		||||
</html>
 | 
			
		||||
@@ -0,0 +1,61 @@
 | 
			
		||||
@{
 | 
			
		||||
    ViewBag.Title = "";
 | 
			
		||||
    Layout = "~/Areas/Admin/Shared/_Layout.cshtml";
 | 
			
		||||
}
 | 
			
		||||
<div class="layui-side layui-bg-black">
 | 
			
		||||
    <div class="layui-side-scroll">
 | 
			
		||||
        <!-- 左侧导航区域(可配合layui已有的垂直导航) -->
 | 
			
		||||
        <ul class="layui-nav layui-nav-tree" lay-filter="test">
 | 
			
		||||
            <li class="layui-nav-item layui-nav-itemed">
 | 
			
		||||
                <a class="" href="javascript:;">论坛管理</a>
 | 
			
		||||
                <dl class="layui-nav-child menu-item">
 | 
			
		||||
                    <dd><a href="javascript:void(0);" datajson="{}" path="/Admin/BBS/Index">论坛文章</a></dd>
 | 
			
		||||
                    <dd><a href="javascript:void(0);" datajson="{}" path="/Admin/BBS/Index">论坛标签</a></dd>
 | 
			
		||||
                    <dd><a href="javascript:void(0);" datajson="{}" path="/Admin/BBS/Index">论坛内容分析</a></dd>
 | 
			
		||||
                    <dd><a href="/BBS/BBS/Index" target="_blank">查看论坛</a></dd>
 | 
			
		||||
                </dl>
 | 
			
		||||
            </li>
 | 
			
		||||
        </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<div class="layui-body">
 | 
			
		||||
    <!-- 内容主体区域 -->
 | 
			
		||||
    <div style="padding: 15px;" id="page_content">
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
    var showLoading = function (obj) {
 | 
			
		||||
 | 
			
		||||
        var index = layer.msg(obj.msg, {
 | 
			
		||||
            icon: 16,
 | 
			
		||||
            shade: 0.1,
 | 
			
		||||
            shadeClose: false,
 | 
			
		||||
        });
 | 
			
		||||
        return index;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    var closeLoading = function (index) {
 | 
			
		||||
        layer.close(index);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $(".menu-item>dd>a").click(function () {
 | 
			
		||||
        var path_item = $(this).attr("path");
 | 
			
		||||
        var path_json = $(this).attr("datajson");
 | 
			
		||||
 | 
			
		||||
        var index = showLoading({ msg: "数据加载中......" });
 | 
			
		||||
        $("#page_content").load(path_item, $.parseJSON(path_json), function () {
 | 
			
		||||
            //初始化绑定页面的时间,例如时间控件
 | 
			
		||||
            closeLoading(index);
 | 
			
		||||
            index = -1;
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        //如果出现长时间未关闭,定时关闭loading
 | 
			
		||||
        setTimeout(function () {
 | 
			
		||||
            if (index >= 0) closeLoading(index);
 | 
			
		||||
        }, 5000);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,197 @@
 | 
			
		||||
 | 
			
		||||
@{
 | 
			
		||||
    ViewBag.Title = ".NET文档园 .NET开源ORM - 首页";
 | 
			
		||||
}
 | 
			
		||||
@using FreeSql.Site.UI.Areas.BBS.Models;
 | 
			
		||||
 | 
			
		||||
<table class="layui-hide" id="test" lay-filter="test"></table>
 | 
			
		||||
 | 
			
		||||
<script type="text/html" id="docContentEdit">
 | 
			
		||||
    <form class="layui-form" action="">
 | 
			
		||||
        <div class="layui-form-item">
 | 
			
		||||
            <label class="layui-form-label">输入框</label>
 | 
			
		||||
            <div class="layui-input-block">
 | 
			
		||||
                <input type="text" name="username" lay-verify="title" autocomplete="off" placeholder="请输入标题" class="layui-input">
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="layui-form-item">
 | 
			
		||||
            <label class="layui-form-label">密码框</label>
 | 
			
		||||
            <div class="layui-input-block">
 | 
			
		||||
                <input type="password" name="password" placeholder="请输入密码" autocomplete="off" class="layui-input">
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <div class="layui-form-item">
 | 
			
		||||
            <label class="layui-form-label">选择框</label>
 | 
			
		||||
            <div class="layui-input-block">
 | 
			
		||||
                <select name="interest" lay-filter="aihao">
 | 
			
		||||
                    <option value=""></option>
 | 
			
		||||
                    <option value="0">写作</option>
 | 
			
		||||
                    <option value="1">阅读</option>
 | 
			
		||||
                    <option value="2">游戏</option>
 | 
			
		||||
                    <option value="3">音乐</option>
 | 
			
		||||
                    <option value="4">旅行</option>
 | 
			
		||||
                </select>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <div class="layui-form-item">
 | 
			
		||||
            <label class="layui-form-label">复选框</label>
 | 
			
		||||
            <div class="layui-input-block">
 | 
			
		||||
                <input type="checkbox" name="like[write]" title="写作">
 | 
			
		||||
                <input type="checkbox" name="like[read]" title="阅读">
 | 
			
		||||
                <input type="checkbox" name="like[daze]" title="发呆">
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <div class="layui-form-item">
 | 
			
		||||
            <label class="layui-form-label">开关</label>
 | 
			
		||||
            <div class="layui-input-block">
 | 
			
		||||
                <input type="checkbox" name="close" lay-skin="switch" lay-text="ON|OFF">
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        <div class="layui-form-item">
 | 
			
		||||
            <label class="layui-form-label">单选框</label>
 | 
			
		||||
            <div class="layui-input-block">
 | 
			
		||||
                <input type="radio" name="sex" value="男" title="男" checked="">
 | 
			
		||||
                <input type="radio" name="sex" value="女" title="女">
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="layui-form-item layui-form-text">
 | 
			
		||||
            <label class="layui-form-label">文本域</label>
 | 
			
		||||
            <div class="layui-input-block">
 | 
			
		||||
                <textarea placeholder="请输入内容" class="layui-textarea" name="desc"></textarea>
 | 
			
		||||
            </div>
 | 
			
		||||
        </div>
 | 
			
		||||
 | 
			
		||||
        @*<div class="layui-form-item">
 | 
			
		||||
                <div class="layui-input-block">
 | 
			
		||||
                    <button class="layui-btn" id="btnSubmit">立即提交</button>
 | 
			
		||||
                </div>
 | 
			
		||||
            </div>*@
 | 
			
		||||
    </form>
 | 
			
		||||
</script>
 | 
			
		||||
<script type="text/html" id="toolbarDemo">
 | 
			
		||||
    <div class="layui-btn-container">
 | 
			
		||||
        <button class="layui-btn layui-btn-sm" lay-event="getCheckData">获取选中行数据</button>
 | 
			
		||||
        <button class="layui-btn layui-btn-sm" lay-event="getCheckLength">获取选中数目</button>
 | 
			
		||||
        <button class="layui-btn layui-btn-sm" lay-event="isAll">验证是否全选</button>
 | 
			
		||||
    </div>
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<script type="text/html" id="barDemo">
 | 
			
		||||
    <a class="layui-btn layui-btn-xs" lay-event="edit">编辑</a>
 | 
			
		||||
    <a class="layui-btn layui-btn-danger layui-btn-xs" lay-event="del">删除</a>
 | 
			
		||||
</script>
 | 
			
		||||
<script>
 | 
			
		||||
    layui.use(['form', 'layedit', 'laydate', 'table'], function () {
 | 
			
		||||
        var table = layui.table;
 | 
			
		||||
        var form = layui.form
 | 
			
		||||
            , layer = layui.layer
 | 
			
		||||
            , layedit = layui.layedit
 | 
			
		||||
            , laydate = layui.laydate;
 | 
			
		||||
 | 
			
		||||
        //日期
 | 
			
		||||
        laydate.render({
 | 
			
		||||
            elem: '#date'
 | 
			
		||||
        });
 | 
			
		||||
        laydate.render({
 | 
			
		||||
            elem: '#date1'
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        table.render({
 | 
			
		||||
            elem: '#test'
 | 
			
		||||
            , url: '/Admin/Document/DocContentList'
 | 
			
		||||
            , where: { searchContent: '', seniorQueryJson: "" }
 | 
			
		||||
            , toolbar: '#toolbarDemo'
 | 
			
		||||
            , title: '文档列表'
 | 
			
		||||
            , cols: [[
 | 
			
		||||
                { type: 'checkbox', fixed: 'left' }
 | 
			
		||||
                , { field: 'ID', title: 'ID', width: 80, fixed: 'left', unresize: true, sort: true }
 | 
			
		||||
                , { field: 'DocTitle', title: '标题', width: 150, edit: 'text' }
 | 
			
		||||
                , { field: 'Status', title: '状态', width: 80, edit: 'text', sort: true }
 | 
			
		||||
                , { field: 'WatchCount', title: '阅读量市', width: 100 }
 | 
			
		||||
                , { field: 'StarCount', title: '获赞数' }
 | 
			
		||||
                , { field: 'CreateDt', title: '创建时间', width: 80, sort: true }
 | 
			
		||||
                , { field: 'UpdateDt', title: '修改时间', width: 120 }
 | 
			
		||||
                , { fixed: 'right', title: '操作', toolbar: '#barDemo', width: 150 }
 | 
			
		||||
            ]]
 | 
			
		||||
            , page: true
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        //头工具栏事件
 | 
			
		||||
        table.on('toolbar(test)', function (obj) {
 | 
			
		||||
            var checkStatus = table.checkStatus(obj.config.id);
 | 
			
		||||
            switch (obj.event) {
 | 
			
		||||
                case 'getCheckData':
 | 
			
		||||
                    var data = checkStatus.data;
 | 
			
		||||
                    layer.alert(JSON.stringify(data));
 | 
			
		||||
                    break;
 | 
			
		||||
                case 'getCheckLength':
 | 
			
		||||
                    var data = checkStatus.data;
 | 
			
		||||
                    layer.msg('选中了:' + data.length + ' 个');
 | 
			
		||||
                    break;
 | 
			
		||||
                case 'isAll':
 | 
			
		||||
                    layer.msg(checkStatus.isAll ? '全选' : '未全选');
 | 
			
		||||
                    break;
 | 
			
		||||
            };
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        //监听行工具事件
 | 
			
		||||
        table.on('tool(test)', function (obj) {
 | 
			
		||||
            var data = obj.data;
 | 
			
		||||
            //console.log(obj)
 | 
			
		||||
            if (obj.event === 'del') {
 | 
			
		||||
                layer.confirm('确定要删除吗?', function (index) {
 | 
			
		||||
                    //调用删除
 | 
			
		||||
                    $.ajax({
 | 
			
		||||
                        type: "POST",
 | 
			
		||||
                        url: "/Admin/Document/DocContentDelete",
 | 
			
		||||
                        data: { id: docid },
 | 
			
		||||
                        dataType: "html",
 | 
			
		||||
                        success: function (data) {
 | 
			
		||||
                            obj.del();
 | 
			
		||||
                            layer.close(index);
 | 
			
		||||
                        },
 | 
			
		||||
                        error: function () {
 | 
			
		||||
                            layer.close(index);
 | 
			
		||||
                            layer.alert("删除失败!");
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
                });
 | 
			
		||||
            } else if (obj.event === 'edit') {
 | 
			
		||||
                layer.open({
 | 
			
		||||
                    type: 1,
 | 
			
		||||
                    maxmin: true,
 | 
			
		||||
                    title: "编辑",
 | 
			
		||||
                    area: ['600px', '360px'],
 | 
			
		||||
                    shadeClose: true, //点击遮罩关闭
 | 
			
		||||
                    content: $("#docContentEdit").html(),
 | 
			
		||||
                    btn: ['保存', '修改状态', '取消'],
 | 
			
		||||
                    yes: function () {
 | 
			
		||||
                        alert('提交');
 | 
			
		||||
                    },
 | 
			
		||||
                    success: function (layero, index) {
 | 
			
		||||
                        form.render();
 | 
			
		||||
                    }
 | 
			
		||||
                });
 | 
			
		||||
                //form.render();
 | 
			
		||||
                //layer.prompt({
 | 
			
		||||
                //    formType: 2
 | 
			
		||||
                //    , value: data.email
 | 
			
		||||
                //}, function (value, index) {
 | 
			
		||||
                //    obj.update({
 | 
			
		||||
                //        email: value
 | 
			
		||||
                //    });
 | 
			
		||||
                //    layer.close(index);
 | 
			
		||||
                //});
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $(document).on('click', '#btnSubmit', function () {
 | 
			
		||||
            layer.msg('响应点击事件');
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,79 @@
 | 
			
		||||
@{
 | 
			
		||||
    ViewBag.Title = "";
 | 
			
		||||
 | 
			
		||||
    //Layout = "~/Areas/Admin/Shared/_Layout.cshtml";
 | 
			
		||||
}
 | 
			
		||||
<form class="layui-form" action="">
 | 
			
		||||
    <div class="layui-form-item">
 | 
			
		||||
        <label class="layui-form-label">输入框</label>
 | 
			
		||||
        <div class="layui-input-block">
 | 
			
		||||
            <input type="text" name="title" required lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="layui-form-item">
 | 
			
		||||
        <label class="layui-form-label">密码框</label>
 | 
			
		||||
        <div class="layui-input-inline">
 | 
			
		||||
            <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
 | 
			
		||||
        </div>
 | 
			
		||||
        <div class="layui-form-mid layui-word-aux">辅助文字</div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="layui-form-item">
 | 
			
		||||
        <label class="layui-form-label">选择框</label>
 | 
			
		||||
        <div class="layui-input-block">
 | 
			
		||||
            <select name="city" lay-verify="required">
 | 
			
		||||
                <option value=""></option>
 | 
			
		||||
                <option value="0">北京</option>
 | 
			
		||||
                <option value="1">上海</option>
 | 
			
		||||
                <option value="2">广州</option>
 | 
			
		||||
                <option value="3">深圳</option>
 | 
			
		||||
                <option value="4">杭州</option>
 | 
			
		||||
            </select>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="layui-form-item">
 | 
			
		||||
        <label class="layui-form-label">复选框</label>
 | 
			
		||||
        <div class="layui-input-block">
 | 
			
		||||
            <input type="checkbox" name="like[write]" title="写作">
 | 
			
		||||
            <input type="checkbox" name="like[read]" title="阅读" checked>
 | 
			
		||||
            <input type="checkbox" name="like[dai]" title="发呆">
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="layui-form-item">
 | 
			
		||||
        <label class="layui-form-label">开关</label>
 | 
			
		||||
        <div class="layui-input-block">
 | 
			
		||||
            <input type="checkbox" name="switch" lay-skin="switch">
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="layui-form-item">
 | 
			
		||||
        <label class="layui-form-label">单选框</label>
 | 
			
		||||
        <div class="layui-input-block">
 | 
			
		||||
            <input type="radio" name="sex" value="男" title="男">
 | 
			
		||||
            <input type="radio" name="sex" value="女" title="女" checked>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="layui-form-item layui-form-text">
 | 
			
		||||
        <label class="layui-form-label">文本域</label>
 | 
			
		||||
        <div class="layui-input-block">
 | 
			
		||||
            <textarea name="desc" placeholder="请输入内容" class="layui-textarea"></textarea>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="layui-form-item">
 | 
			
		||||
        <div class="layui-input-block">
 | 
			
		||||
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
 | 
			
		||||
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
 | 
			
		||||
        </div>
 | 
			
		||||
    </div>
 | 
			
		||||
</form>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
    //Demo
 | 
			
		||||
    layui.use('form', function () {
 | 
			
		||||
        var form = layui.form;
 | 
			
		||||
        form.render();
 | 
			
		||||
        //监听提交
 | 
			
		||||
        form.on('submit(formDemo)', function (data) {
 | 
			
		||||
            layer.msg(JSON.stringify(data.field));
 | 
			
		||||
            return false;
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,66 @@
 | 
			
		||||
@{
 | 
			
		||||
    ViewBag.Title = "";
 | 
			
		||||
    Layout = "~/Areas/Admin/Shared/_Layout.cshtml";
 | 
			
		||||
}
 | 
			
		||||
<div class="layui-side layui-bg-black">
 | 
			
		||||
    <div class="layui-side-scroll">
 | 
			
		||||
        <!-- 左侧导航区域(可配合layui已有的垂直导航) -->
 | 
			
		||||
        <ul class="layui-nav layui-nav-tree" lay-filter="test">
 | 
			
		||||
            <li class="layui-nav-item layui-nav-itemed">
 | 
			
		||||
                <a class="" href="javascript:;">文档管理</a>
 | 
			
		||||
                <dl class="layui-nav-child menu-item">
 | 
			
		||||
                    <dd><a href="javascript:void(0);" datajson="{}" path="/Admin/Document/DocContent">文档分类</a></dd>
 | 
			
		||||
                    <dd><a href="javascript:void(0);" datajson="{}" path="/Admin/Document/DocType">文档内容</a></dd>
 | 
			
		||||
                    <dd><a href="/Doc/Documents/Index" target="_blank">查看文档</a></dd>
 | 
			
		||||
                </dl>
 | 
			
		||||
            </li>
 | 
			
		||||
        </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<div class="layui-body">
 | 
			
		||||
    <!-- 内容主体区域 -->
 | 
			
		||||
    <div style="padding: 15px;" id="page_content">
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
    //Demo
 | 
			
		||||
    
 | 
			
		||||
    var showLoading = function (obj) {
 | 
			
		||||
 | 
			
		||||
        var index = layer.msg(obj.msg, {
 | 
			
		||||
            icon: 16,
 | 
			
		||||
            shade: 0.1,
 | 
			
		||||
            shadeClose: false,
 | 
			
		||||
        });
 | 
			
		||||
        return index;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    var closeLoading = function (index) {
 | 
			
		||||
        layer.close(index);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $(".menu-item>dd>a").click(function () {
 | 
			
		||||
        var path_item = $(this).attr("path");
 | 
			
		||||
        var path_json = $(this).attr("datajson");
 | 
			
		||||
 | 
			
		||||
        var index = showLoading({ msg: "数据加载中......" });
 | 
			
		||||
        $("#page_content").load(path_item, $.parseJSON(path_json), function () {
 | 
			
		||||
            //初始化绑定页面的时间,例如时间控件
 | 
			
		||||
            closeLoading(index);
 | 
			
		||||
            index = -1;
 | 
			
		||||
            layui.use('form', function () {
 | 
			
		||||
                var form = layui.form;
 | 
			
		||||
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        //如果出现长时间未关闭,定时关闭loading
 | 
			
		||||
        setTimeout(function () {
 | 
			
		||||
            if (index >= 0) closeLoading(index);
 | 
			
		||||
        }, 5000);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,61 @@
 | 
			
		||||
@{
 | 
			
		||||
    ViewBag.Title = "";
 | 
			
		||||
    Layout = "~/Areas/Admin/Shared/_Layout.cshtml";
 | 
			
		||||
}
 | 
			
		||||
<div class="layui-side layui-bg-black">
 | 
			
		||||
    <div class="layui-side-scroll">
 | 
			
		||||
        <!-- 左侧导航区域(可配合layui已有的垂直导航) -->
 | 
			
		||||
        <ul class="layui-nav layui-nav-tree" lay-filter="test">
 | 
			
		||||
            <li class="layui-nav-item layui-nav-itemed">
 | 
			
		||||
                <a class="" href="javascript:;">系统设置</a>
 | 
			
		||||
                <dl class="layui-nav-child menu-item">
 | 
			
		||||
                    <dd><a href="javascript:void(0);" datajson="{}" path="/Admin/BBS/Index">论坛文章</a></dd>
 | 
			
		||||
                    <dd><a href="javascript:void(0);" datajson="{}" path="/Admin/BBS/Index">论坛标签</a></dd>
 | 
			
		||||
                    <dd><a href="javascript:void(0);" datajson="{}" path="/Admin/BBS/Index">论坛内容分析</a></dd>
 | 
			
		||||
                    <dd><a href="/BBS/BBS/Index" target="_blank">查看论坛</a></dd>
 | 
			
		||||
                </dl>
 | 
			
		||||
            </li>
 | 
			
		||||
        </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<div class="layui-body">
 | 
			
		||||
    <!-- 内容主体区域 -->
 | 
			
		||||
    <div style="padding: 15px;" id="page_content">
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
    var showLoading = function (obj) {
 | 
			
		||||
 | 
			
		||||
        var index = layer.msg(obj.msg, {
 | 
			
		||||
            icon: 16,
 | 
			
		||||
            shade: 0.1,
 | 
			
		||||
            shadeClose: false,
 | 
			
		||||
        });
 | 
			
		||||
        return index;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    var closeLoading = function (index) {
 | 
			
		||||
        layer.close(index);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $(".menu-item>dd>a").click(function () {
 | 
			
		||||
        var path_item = $(this).attr("path");
 | 
			
		||||
        var path_json = $(this).attr("datajson");
 | 
			
		||||
 | 
			
		||||
        var index = showLoading({ msg: "数据加载中......" });
 | 
			
		||||
        $("#page_content").load(path_item, $.parseJSON(path_json), function () {
 | 
			
		||||
            //初始化绑定页面的时间,例如时间控件
 | 
			
		||||
            closeLoading(index);
 | 
			
		||||
            index = -1;
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        //如果出现长时间未关闭,定时关闭loading
 | 
			
		||||
        setTimeout(function () {
 | 
			
		||||
            if (index >= 0) closeLoading(index);
 | 
			
		||||
        }, 5000);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,4 @@
 | 
			
		||||
@{
 | 
			
		||||
    ViewBag.Title = "";
 | 
			
		||||
}
 | 
			
		||||
系统参数设置
 | 
			
		||||
@@ -0,0 +1,62 @@
 | 
			
		||||
@{
 | 
			
		||||
    ViewBag.Title = "";
 | 
			
		||||
    Layout = "~/Areas/Admin/Shared/_Layout.cshtml";
 | 
			
		||||
}
 | 
			
		||||
<div class="layui-side layui-bg-black">
 | 
			
		||||
    <div class="layui-side-scroll">
 | 
			
		||||
        <!-- 左侧导航区域(可配合layui已有的垂直导航) -->
 | 
			
		||||
        <ul class="layui-nav layui-nav-tree" lay-filter="test">
 | 
			
		||||
            <li class="layui-nav-item layui-nav-itemed">
 | 
			
		||||
                <a class="" href="javascript:;">模板管理</a>
 | 
			
		||||
                <dl class="layui-nav-child menu-item">
 | 
			
		||||
                    <dd><a href="javascript:void(0);" datajson="{}" path="/Admin/Template/Index">示例模板</a></dd>
 | 
			
		||||
                    <dd><a href="javascript:void(0);" datajson="{}" path="/Admin/Template/Index">模板列表</a></dd>
 | 
			
		||||
                    <dd><a href="javascript:void(0);" datajson="{}" path="/Admin/Template/Index">模板统计</a></dd>
 | 
			
		||||
                    <dd><a href="/Example/Template/Index" target="_blank">查看模板</a></dd>
 | 
			
		||||
                    <dd><a href="/Example/Main/Index" target="_blank">查看示例</a></dd>
 | 
			
		||||
                </dl>
 | 
			
		||||
            </li>
 | 
			
		||||
        </ul>
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<div class="layui-body">
 | 
			
		||||
    <!-- 内容主体区域 -->
 | 
			
		||||
    <div style="padding: 15px;" id="page_content">
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
</div>
 | 
			
		||||
 | 
			
		||||
<script>
 | 
			
		||||
    var showLoading = function (obj) {
 | 
			
		||||
 | 
			
		||||
        var index = layer.msg(obj.msg, {
 | 
			
		||||
            icon: 16,
 | 
			
		||||
            shade: 0.1,
 | 
			
		||||
            shadeClose: false,
 | 
			
		||||
        });
 | 
			
		||||
        return index;
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    var closeLoading = function (index) {
 | 
			
		||||
        layer.close(index);
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    $(".menu-item>dd>a").click(function () {
 | 
			
		||||
        var path_item = $(this).attr("path");
 | 
			
		||||
        var path_json = $(this).attr("datajson");
 | 
			
		||||
 | 
			
		||||
        var index = showLoading({ msg: "数据加载中......" });
 | 
			
		||||
        $("#page_content").load(path_item, $.parseJSON(path_json), function () {
 | 
			
		||||
            //初始化绑定页面的时间,例如时间控件
 | 
			
		||||
            closeLoading(index);
 | 
			
		||||
            index = -1;
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        //如果出现长时间未关闭,定时关闭loading
 | 
			
		||||
        setTimeout(function () {
 | 
			
		||||
            if (index >= 0) closeLoading(index);
 | 
			
		||||
        }, 5000);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
</script>
 | 
			
		||||
@@ -0,0 +1,3 @@
 | 
			
		||||
@{
 | 
			
		||||
    Layout = null;
 | 
			
		||||
}
 | 
			
		||||
@@ -28,7 +28,7 @@ namespace FreeSql.Site.UI.Areas.Doc.Controllers
 | 
			
		||||
        public IActionResult Index(int id = 1)
 | 
			
		||||
        {
 | 
			
		||||
            var typeList = DocumentTypeDAL.Query(d => d.ID != 0);
 | 
			
		||||
            var contentlist = DocumentContentDAL.Query(d => d.Status == 1);
 | 
			
		||||
            var contentlist = DocumentContentDAL.Query(d => d.Status == 1).list;
 | 
			
		||||
 | 
			
		||||
            //适应两层结构即可
 | 
			
		||||
            var query = (from p in typeList
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,6 @@
 | 
			
		||||
@*
 | 
			
		||||
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
 | 
			
		||||
*@
 | 
			
		||||
@{
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
@@ -12,7 +12,7 @@
 | 
			
		||||
else
 | 
			
		||||
{
 | 
			
		||||
    <h1 class="site-h1">@*开始使用 - 入门指南*@@documentinfo.DocTitle</h1>
 | 
			
		||||
    <div id="details_content" >
 | 
			
		||||
    <div id="details_content" style="display:none;">
 | 
			
		||||
        @*<markdown>@documentinfo.DocContent</markdown>*@
 | 
			
		||||
        @documentinfo.DocContent
 | 
			
		||||
        @*<blockquote class="layui-elem-quote">
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,35 @@
 | 
			
		||||
using System;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using System.Linq;
 | 
			
		||||
using System.Linq.Expressions;
 | 
			
		||||
using System.Threading.Tasks;
 | 
			
		||||
 | 
			
		||||
namespace FreeSql.Site.UI.Common
 | 
			
		||||
{
 | 
			
		||||
    public static class PredicateExtensions
 | 
			
		||||
    {
 | 
			
		||||
        public static Expression<Func<T, bool>> True<T>() { return f => true; }
 | 
			
		||||
 | 
			
		||||
        public static Expression<Func<T, bool>> False<T>() { return f => false; }
 | 
			
		||||
 | 
			
		||||
        public static Expression<Func<T, bool>> Or<T>(this Expression<Func<T, bool>> expression1,
 | 
			
		||||
           Expression<Func<T, bool>> expression2)
 | 
			
		||||
        {
 | 
			
		||||
            var invokedExpression = Expression.Invoke(expression2, expression1.Parameters
 | 
			
		||||
                    .Cast<Expression>());
 | 
			
		||||
 | 
			
		||||
            return Expression.Lambda<Func<T, bool>>(Expression.Or(expression1.Body, invokedExpression),
 | 
			
		||||
            expression1.Parameters);
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        public static Expression<Func<T, bool>> And<T>(this Expression<Func<T, bool>> expression1,
 | 
			
		||||
              Expression<Func<T, bool>> expression2)
 | 
			
		||||
        {
 | 
			
		||||
            var invokedExpression = Expression.Invoke(expression2, expression1.Parameters
 | 
			
		||||
                 .Cast<Expression>());
 | 
			
		||||
 | 
			
		||||
            return Expression.Lambda<Func<T, bool>>(Expression.And(expression1.Body,
 | 
			
		||||
                   invokedExpression), expression1.Parameters);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
@@ -10,6 +10,7 @@
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Folder Include="Areas\Admin\Data\" />
 | 
			
		||||
    <Folder Include="Areas\BBS\Data\" />
 | 
			
		||||
    <Folder Include="Areas\Doc\Data\" />
 | 
			
		||||
    <Folder Include="Areas\Doc\Models\" />
 | 
			
		||||
@@ -23,6 +24,13 @@
 | 
			
		||||
  </ItemGroup>
 | 
			
		||||
 | 
			
		||||
  <ItemGroup>
 | 
			
		||||
    <Content Update="Areas\Admin\Views\Document\DocType.cshtml">
 | 
			
		||||
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
 | 
			
		||||
    </Content>
 | 
			
		||||
    <Content Update="Areas\Admin\_ViewStart.cshtml">
 | 
			
		||||
      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
 | 
			
		||||
      <Pack>$(IncludeRazorContentInPack)</Pack>
 | 
			
		||||
    </Content>
 | 
			
		||||
    <Content Update="Areas\BBS\_ViewStart.cshtml">
 | 
			
		||||
      <Pack>$(IncludeRazorContentInPack)</Pack>
 | 
			
		||||
    </Content>
 | 
			
		||||
 
 | 
			
		||||
@@ -2,11 +2,21 @@
 | 
			
		||||
  "ConnectionStrings": {
 | 
			
		||||
    "DefaultDbContext": "Data Source=127.0.0.1;Port=3307;User ID=root;Password=abc123456;Database=FreeSqlTest;Charset=utf8;SslMode=none;Max pool size=10"
 | 
			
		||||
  },
 | 
			
		||||
  "Logging": {
 | 
			
		||||
    "LogLevel": {
 | 
			
		||||
      "Default": "Debug",
 | 
			
		||||
      "System": "Information",
 | 
			
		||||
      "Microsoft": "Information"
 | 
			
		||||
  "DbContexts": {
 | 
			
		||||
    "SqlServer": {
 | 
			
		||||
      "ConnectionString": "Data Source=127.0.0.1;Port=3307;User ID=root;Password=abc123456;Database=FreeSqlTest;Charset=utf8;SslMode=none;Max pool size=10",
 | 
			
		||||
      "IsAutoMigration": true
 | 
			
		||||
    },
 | 
			
		||||
    "MySql": {
 | 
			
		||||
      "ConnectionString": "Data Source=127.0.0.1;Port=3307;User ID=root;Password=abc123456;Database=FreeSqlTest;Charset=utf8;SslMode=none;Max pool size=10",
 | 
			
		||||
      "IsAutoMigration": true
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
    "Logging": {
 | 
			
		||||
      "LogLevel": {
 | 
			
		||||
        "Default": "Debug",
 | 
			
		||||
        "System": "Information",
 | 
			
		||||
        "Microsoft": "Information"
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										95
									
								
								Examples/website/FreeSql.Site.UI/wwwroot/demo1.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										95
									
								
								Examples/website/FreeSql.Site.UI/wwwroot/demo1.json
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,95 @@
 | 
			
		||||
{
 | 
			
		||||
  "code": 0
 | 
			
		||||
  ,"msg": ""
 | 
			
		||||
  ,"count": 3000000
 | 
			
		||||
  ,"data": [{
 | 
			
		||||
    "id": "10001"
 | 
			
		||||
    ,"username": "杜甫"
 | 
			
		||||
    ,"email": "xianxin@layui.com"
 | 
			
		||||
    ,"sex": "男"
 | 
			
		||||
    ,"city": "浙江杭州"
 | 
			
		||||
    ,"sign": "点击此处,显示更多。当内容超出时,点击单元格会自动显示更多内容。"
 | 
			
		||||
    ,"experience": "116"
 | 
			
		||||
    ,"ip": "192.168.0.8"
 | 
			
		||||
    ,"logins": "108"
 | 
			
		||||
    ,"joinTime": "2016-10-14"
 | 
			
		||||
  }, {
 | 
			
		||||
    "id": "10002"
 | 
			
		||||
    ,"username": "李白"
 | 
			
		||||
    ,"email": "xianxin@layui.com"
 | 
			
		||||
    ,"sex": "男"
 | 
			
		||||
    ,"city": "浙江杭州"
 | 
			
		||||
    ,"sign": "君不见,黄河之水天上来,奔流到海不复回。 君不见,高堂明镜悲白发,朝如青丝暮成雪。 人生得意须尽欢,莫使金樽空对月。 天生我材必有用,千金散尽还复来。 烹羊宰牛且为乐,会须一饮三百杯。 岑夫子,丹丘生,将进酒,杯莫停。 与君歌一曲,请君为我倾耳听。(倾耳听 一作:侧耳听) 钟鼓馔玉不足贵,但愿长醉不复醒。(不足贵 一作:何足贵;不复醒 一作:不愿醒/不用醒) 古来圣贤皆寂寞,惟有饮者留其名。(古来 一作:自古;惟 通:唯) 陈王昔时宴平乐,斗酒十千恣欢谑。 主人何为言少钱,径须沽取对君酌。 五花马,千金裘,呼儿将出换美酒,与尔同销万古愁。"
 | 
			
		||||
    ,"experience": "12"
 | 
			
		||||
    ,"ip": "192.168.0.8"
 | 
			
		||||
    ,"logins": "106"
 | 
			
		||||
    ,"joinTime": "2016-10-14"
 | 
			
		||||
    ,"LAY_CHECKED": true
 | 
			
		||||
  }, {
 | 
			
		||||
    "id": "10003"
 | 
			
		||||
    ,"username": "王勃"
 | 
			
		||||
    ,"email": "xianxin@layui.com"
 | 
			
		||||
    ,"sex": "男"
 | 
			
		||||
    ,"city": "浙江杭州"
 | 
			
		||||
    ,"sign": "人生恰似一场修行"
 | 
			
		||||
    ,"experience": "65"
 | 
			
		||||
    ,"ip": "192.168.0.8"
 | 
			
		||||
    ,"logins": "106"
 | 
			
		||||
    ,"joinTime": "2016-10-14"
 | 
			
		||||
  }, {
 | 
			
		||||
    "id": "10004"
 | 
			
		||||
    ,"username": "李清照"
 | 
			
		||||
    ,"email": "xianxin@layui.com"
 | 
			
		||||
    ,"sex": "女"
 | 
			
		||||
    ,"city": "浙江杭州"
 | 
			
		||||
    ,"sign": "人生恰似一场修行"
 | 
			
		||||
    ,"experience": "666"
 | 
			
		||||
    ,"ip": "192.168.0.8"
 | 
			
		||||
    ,"logins": "106"
 | 
			
		||||
    ,"joinTime": "2016-10-14"
 | 
			
		||||
  }, {
 | 
			
		||||
    "id": "10005"
 | 
			
		||||
    ,"username": "冰心"
 | 
			
		||||
    ,"email": "xianxin@layui.com"
 | 
			
		||||
    ,"sex": "女"
 | 
			
		||||
    ,"city": "浙江杭州"
 | 
			
		||||
    ,"sign": "人生恰似一场修行"
 | 
			
		||||
    ,"experience": "86"
 | 
			
		||||
    ,"ip": "192.168.0.8"
 | 
			
		||||
    ,"logins": "106"
 | 
			
		||||
    ,"joinTime": "2016-10-14"
 | 
			
		||||
  }, {
 | 
			
		||||
    "id": "10006"
 | 
			
		||||
    ,"username": "贤心"
 | 
			
		||||
    ,"email": "xianxin@layui.com"
 | 
			
		||||
    ,"sex": "男"
 | 
			
		||||
    ,"city": "浙江杭州"
 | 
			
		||||
    ,"sign": "人生恰似一场修行"
 | 
			
		||||
    ,"experience": "12"
 | 
			
		||||
    ,"ip": "192.168.0.8"
 | 
			
		||||
    ,"logins": "106"
 | 
			
		||||
    ,"joinTime": "2016-10-14"
 | 
			
		||||
  }, {
 | 
			
		||||
    "id": "10007"
 | 
			
		||||
    ,"username": "贤心"
 | 
			
		||||
    ,"email": "xianxin@layui.com"
 | 
			
		||||
    ,"sex": "男"
 | 
			
		||||
    ,"city": "浙江杭州"
 | 
			
		||||
    ,"sign": "人生恰似一场修行"
 | 
			
		||||
    ,"experience": "16"
 | 
			
		||||
    ,"ip": "192.168.0.8"
 | 
			
		||||
    ,"logins": "106"
 | 
			
		||||
    ,"joinTime": "2016-10-14"
 | 
			
		||||
  }, {
 | 
			
		||||
    "id": "10008"
 | 
			
		||||
    ,"username": "贤心"
 | 
			
		||||
    ,"email": "xianxin@layui.com"
 | 
			
		||||
    ,"sex": "男"
 | 
			
		||||
    ,"city": "浙江杭州"
 | 
			
		||||
    ,"sign": "人生恰似一场修行"
 | 
			
		||||
    ,"experience": "106"
 | 
			
		||||
    ,"ip": "192.168.0.8"
 | 
			
		||||
    ,"logins": "106"
 | 
			
		||||
    ,"joinTime": "2016-10-14"
 | 
			
		||||
  }]
 | 
			
		||||
}  
 | 
			
		||||
		Reference in New Issue
	
	Block a user