src/mvc/admin/Bootstrap.DataAccess/Dict.cs
(开头部分) 15KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
// Copyright (c) Argo Zhang (argo@163.com). All rights reserved.
// Licensed under the LGPL License, Version 3.0. See License.txt in the project root for license information.
// Website: https://admin.blazor.zone
using Bootstrap.Security;
using Bootstrap.Security.DataAccess;
using Longbow;
using PetaPoco;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Bootstrap.DataAccess
{
/// <summary>
/// 字典表实体类
/// </summary>
[TableName("Dicts")]
public class Dict : BootstrapDict
{
/// <summary>
/// 删除字典中的数据
/// </summary>
/// <param name="value">需要删除的IDs</param>
/// <returns></returns>
public virtual bool Delete(IEnumerable<string> value)
{
if (!value.Any()) return true;
var ids = string.Join(",", value);
string sql = $"where ID in ({ids})";
using var db = DbManager.Create();
db.Delete<BootstrapDict>(sql);
return true;
}
/// <summary>
/// 保存新建/更新的字典信息
/// </summary>
/// <param name="dict"></param>
/// <returns></returns>
public virtual bool Save(BootstrapDict dict)
{
if (dict.Category.Length > 50) dict.Category = dict.Category.Substring(0, 50);
if (dict.Name.Length > 50) dict.Name = dict.Name.Substring(0, 50);
if (dict.Code.Length > 2000) dict.Code = dict.Code.Substring(0, 2000);
using var db = DbManager.Create();
db.Save(dict);
return true;
}
/// <summary>
/// 保存网站个性化设置
/// </summary>
/// <param name="dicts"></param>
/// <returns></returns>
public virtual bool SaveSettings(IEnumerable<BootstrapDict> dicts)
{
using var db = DbManager.Create();
dicts.ToList().ForEach(dict => db.Update<Dict>("set Code = @Code where Category = @Category and Name = @Name", dict));
后面还有 285 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明
AI 解读
登录后可用,每次 10 积分,解读结果公开显示在下面。
还没有人解读过这个文件。
