浏览代码

修正保存专题的bug

懒得勤快 4 年之前
父节点
当前提交
5c2c290634

+ 1 - 17
src/Masuit.MyBlogs.Core/Controllers/SeminarController.cs

@@ -6,11 +6,9 @@ using Masuit.MyBlogs.Core.Models;
 using Masuit.MyBlogs.Core.Models.DTO;
 using Masuit.MyBlogs.Core.Models.Entity;
 using Masuit.MyBlogs.Core.Models.Enum;
-using Masuit.Tools;
 using Masuit.Tools.Systems;
 using Microsoft.AspNetCore.Mvc;
 using System;
-using System.Collections.Generic;
 using System.ComponentModel.DataAnnotations;
 using System.Linq;
 using System.Linq.Dynamic.Core;
@@ -65,21 +63,7 @@ namespace Masuit.MyBlogs.Core.Controllers
         [MyAuthorize]
         public ActionResult Save(Seminar seminar)
         {
-            bool contain;
-            if (seminar.Id > 0)
-            {
-                //更新
-                contain = SeminarService.GetAll().Select(s => s.Title).Except(new List<string>()
-                {
-                    SeminarService.GetById(seminar.Id).Title
-                }).Contains(seminar.Title);
-            }
-            else
-            {
-                //添加
-                contain = SeminarService.GetAll().Select(s => s.Title).Contains(seminar.Title);
-            }
-            if (contain)
+            if (seminar.Id > 0 ? SeminarService.Any(s => s.Id != seminar.Id && s.Title == seminar.Title) : SeminarService.Any(s => s.Title == seminar.Title))
             {
                 return ResultData(null, false, $"{seminar.Title} 已经存在了");
             }

+ 1 - 1
src/Masuit.MyBlogs.Core/Masuit.MyBlogs.Core.csproj

@@ -34,7 +34,7 @@
         <PackageReference Include="CacheManager.StackExchange.Redis" Version="1.2.0" />
         <PackageReference Include="CHTCHSConv" Version="1.0.0" />
         <PackageReference Include="CSRedisCore" Version="3.6.6" />
-        <PackageReference Include="EFCoreSecondLevelCacheInterceptor" Version="2.7.0" />
+        <PackageReference Include="EFCoreSecondLevelCacheInterceptor" Version="2.8.0" />
         <PackageReference Include="Hangfire" Version="1.7.22" />
         <PackageReference Include="Hangfire.Autofac" Version="2.3.1" />
         <PackageReference Include="Hangfire.MemoryStorage" Version="1.7.0" />

+ 3 - 2
src/Masuit.MyBlogs.Core/Views/Dashboard/Index.cshtml

@@ -1,4 +1,5 @@
-
+@using StackExchange.Profiling
+
 @{
     Layout = null;
 }
@@ -80,6 +81,6 @@
             </div>
         </section>
     </section>
-    <mini-profiler max-traces="5" />
+    <mini-profiler max-traces="5" position="RenderPosition.BottomLeft" />
 </body>
 </html>

+ 4 - 0
src/Masuit.MyBlogs.Core/wwwroot/ng-views/css/app.css

@@ -16248,4 +16248,8 @@ table.table >tbody > tr>td img {
 }
 .layui-layer-shade {
     z-index: 6 !important;
+}
+.mp-results.mp-bottomleft {
+    top: auto !important;
+    bottom: 0;
 }