From 7f26cd7c3e492062418cdc7dbe9d7ce14cbe5f05 Mon Sep 17 00:00:00 2001
From: username@email.com <yzy2002yzy@163.com>
Date: 星期三, 26 六月 2024 11:47:37 +0800
Subject: [PATCH] 铺货修改

---
 CoreCms.Net.Web.Admin/Controllers/System/CodeGeneratorController.cs |   53 +++++++++++++++++++++++++++++++++++++++++++++++------
 1 files changed, 47 insertions(+), 6 deletions(-)

diff --git a/CoreCms.Net.Web.Admin/Controllers/System/CodeGeneratorController.cs b/CoreCms.Net.Web.Admin/Controllers/System/CodeGeneratorController.cs
index 21cd6e1..1d2ba23 100644
--- a/CoreCms.Net.Web.Admin/Controllers/System/CodeGeneratorController.cs
+++ b/CoreCms.Net.Web.Admin/Controllers/System/CodeGeneratorController.cs
@@ -1,25 +1,30 @@
 锘�/***********************************************************************
- *            Project: CoreCms
- *        ProjectName: 鏍稿績鍐呭绠$悊绯荤粺                                
- *                Web: https://www.corecms.net                      
- *             Author: 澶х伆鐏�                                          
- *              Email: jianweie@163.com                                
- *         CreateTime: 2021/1/31 21:45:10
+ *            Project: baifenBinfa
+ *        ProjectName: 鐧惧垎鍏垫硶绠$悊绯荤粺                               
+ *                Web: http://chuanyin.com                     
+ *             Author:                                        
+ *              Email:                               
+ *         CreateTime: 202403/02   
  *        Description: 鏆傛棤
  ***********************************************************************/
 
 using System;
+using System.CodeDom;
 using System.Collections.Generic;
 using System.ComponentModel;
 using System.IO;
 using System.Linq;
 using System.Threading.Tasks;
 using AutoMapper;
+using Chuanyin.Attribute;
 using CoreCms.Net.Configuration;
+using CoreCms.Net.IRepository.UnitOfWork;
 using CoreCms.Net.IServices;
 using CoreCms.Net.Loging;
+using CoreCms.Net.Model.Entities.Distribution;
 using CoreCms.Net.Model.ViewModels.Basics;
 using CoreCms.Net.Model.ViewModels.UI;
+using CoreCms.Net.Repository.UnitOfWork;
 using CoreCms.Net.Utility.Helper;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Hosting;
@@ -42,6 +47,8 @@
         private readonly IWebHostEnvironment _webHostEnvironment;
 
         private readonly IMapper _mapper;
+        
+    
 
         /// <summary>
         /// 鏋勯�犲嚱鏁�
@@ -51,6 +58,7 @@
             _codeGeneratorServices = codeGeneratorServices;
             _mapper = mapper;
             _webHostEnvironment = webHostEnvironment;
+         
         }
 
 
@@ -255,6 +263,39 @@
 
         #endregion
 
+        #region 鐢熸垚鎴栬�呮洿鏂版暟鎹簱
+        /// <summary>
+        ///  鍒涘缓鍜屾洿鏂版暟鎹簱
+        /// </summary>
+        /// <param name="tableName"></param>
+        /// <param name="fileType"></param>
+        /// <returns></returns>
+        [HttpPost]
+        [Description("鍒涘缓鏂拌〃")]
+        public IActionResult CreateAndUpdateDatabase([FromServices] IUnitOfWork work)
+        {
+            var jm = new AdminUiCallBack();
+            try
+            {
+                Type[]? types = AssemblyHelper.DbCodeFirstModes("CoreCms.Net.Model",thisAttribute: typeof(SqlCodeFirstAttribute));
 
+           
+                work.GetDbClient().CodeFirst.InitTables(types??new Type[] { });
+                jm.code = 0;
+              
+                jm.msg = "鍒涘缓鎴愬姛";
+                return new JsonResult(jm);
+            }
+            catch (Exception e)
+            {
+                jm.msg = e.Message + ":-----" + e.StackTrace;
+                return new JsonResult(jm);
+
+            }
+        
+      
+           
+        }
+        #endregion
     }
 }
\ No newline at end of file

--
Gitblit v1.9.1