ZhouliProject/Zhouli.BLL/Implements/BlogLableBLL.cs

(开头部分) 4KB

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

using AutoMapper;
using System;
using System.Collections.Generic;
using System.Linq;
using Zhouli.BLL.Interface;
using Zhouli.Common.ResultModel;
using Zhouli.DAL.Interface;
using Zhouli.DbEntity.Models;
using Zhouli.DbEntity.Views;
using Zhouli.Dto.ModelDto;
using Zhouli.Enum;

namespace Zhouli.BLL.Implements
{
    public class BlogLableBLL : BaseBLL<BlogLable>, IBlogLableBLL
    {
        private readonly IBlogLableDAL _blogLableDAL;
        /// <summary>
        /// 用于实例化父级,blogLableDAL
        /// </summary>
        /// <param name="BlogLableDAL"></param>
        public BlogLableBLL(IBlogLableDAL blogLableDAL) : base(blogLableDAL)
        {
            this._blogLableDAL = blogLableDAL;
        }
        /// <summary>
        /// 添加/编辑博客标签
        /// </summary>
        /// <param name="bl"></param>
        /// <param name="UserId"></param>
        /// <returns></returns>
        public HandleResult<bool> AddorEditBlogLable(BlogLableDto bl, string UserId)
        {
            var handleResult = new HandleResult<bool>();
            var blogLable = Mapper.Map<BlogLable>(bl);
            //添加
            if (blogLable.LableId == 0)
            {
                int intcount = _blogLableDAL.GetCount(t => t.LableName.Equals(blogLable.LableName) && t.DeleteSign.Equals((int)DeleteSign.Sing_Deleted));
                if (intcount > 0)
                {
                    handleResult.Msg = "博客标签名称已注册";
                    handleResult.Result = false;
                }
                else
                {
                    blogLable.CreateTime = DateTime.Now;
                    blogLable.EditTime = DateTime.Now;
                    blogLable.DeleteSign = (Int32)DeleteSign.Sing_Deleted;
                    blogLable.CreateUserId = UserId;
                    if (Add(blogLable))
                    {
                        handleResult.Msg = "添加成功";
                    }
                    else
                    {
                        handleResult.Msg = "添加失败";
                        handleResult.Result = false;
                    }
                }
后面还有 62 行代码,解锁后查看完整代码

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

AI 解读 AI

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

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