Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Admin panel - save to the log information about the restarted app, clear cache, install and uninstall plugin, upload and remove the plugin
KrzysztofPajak8379af886fd0
diff --git a/src/Web/Grand.Web.Admin/Controllers/PluginController.cs b/src/Web/Grand.Web.Admin/Controllers/PluginController.csindex 4825a0b4a..02e6dcb6e 100644--- a/src/Web/Grand.Web.Admin/Controllers/PluginController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/PluginController.cs@@ -192,6 +192,8 @@ namespace Grand.Web.Admin.ControllersSuccess(_translationService.GetResource("Admin.Plugins.Installed"));+ _ = _logger.InsertLog(Domain.Logging.LogLevel.Information, $"The plugin has been installed by the user {_workContext.CurrentCustomer.Email}");+//stop application_applicationLifetime.StopApplication();}@@ -229,6 +231,8 @@ namespace Grand.Web.Admin.ControllersSuccess(_translationService.GetResource("Admin.Plugins.Uninstalled"));+ _ = _logger.InsertLog(Domain.Logging.LogLevel.Information, $"The plugin has been uninstalled by the user {_workContext.CurrentCustomer.Email}");+//stop application_applicationLifetime.StopApplication();}@@ -275,6 +279,8 @@ namespace Grand.Web.Admin.Controllers//uninstall pluginSuccess(_translationService.GetResource("Admin.Plugins.Removed"));+ _ = _logger.InsertLog(Domain.Logging.LogLevel.Information, $"The plugin has been removed by the user {_workContext.CurrentCustomer.Email}");+//stop application_applicationLifetime.StopApplication();}@@ -288,6 +294,8 @@ namespace Grand.Web.Admin.Controllerspublic IActionResult ReloadList(){+ _ = _logger.InsertLog(Domain.Logging.LogLevel.Information, $"Reload list of plugins by the user {_workContext.CurrentCustomer.Email}");+//stop application_applicationLifetime.StopApplication();return RedirectToAction("List");@@ -335,6 +343,8 @@ namespace Grand.Web.Admin.ControllersSystem.IO.File.Delete(zipFilePath);}+ _ = _logger.InsertLog(Domain.Logging.LogLevel.Information, $"The plugin has been uploaded by the user {_workContext.CurrentCustomer.Email}");+//stop application_applicationLifetime.StopApplication();diff --git a/src/Web/Grand.Web.Admin/Controllers/SystemController.cs b/src/Web/Grand.Web.Admin/Controllers/SystemController.csindex 324c37ecb..ab975b4fa 100644--- a/src/Web/Grand.Web.Admin/Controllers/SystemController.cs+++ b/src/Web/Grand.Web.Admin/Controllers/SystemController.cs@@ -3,6 +3,7 @@ using Grand.Business.Checkout.Interfaces.Payments;using Grand.Business.Checkout.Interfaces.Shipping;using Grand.Business.Common.Interfaces.Directory;using Grand.Business.Common.Interfaces.Localization;+using Grand.Business.Common.Interfaces.Logging;using Grand.Business.Common.Services.Security;using Grand.Business.Storage.Interfaces;using Grand.Business.System.Interfaces.MachineNameProvider;@@ -41,7 +42,7 @@ namespace Grand.Web.Admin.Controllersprivate readonly ITranslationService _translationService;private readonly IMachineNameProvider _machineNameProvider;private readonly IHostApplicationLifetime _applicationLifetime;- private readonly IMediaFileStore _mediaFileStore;+ private readonly ILogger _logger;private readonly CurrencySettings _currencySettings;private readonly MeasureSettings _measureSettings;@@ -59,7 +60,7 @@ namespace Grand.Web.Admin.ControllersITranslationService translationService,IMachineNameProvider machineNameProvider,IHostApplicationLifetime applicationLifetime,- IMediaFileStore mediaFileStore,+ ILogger logger,CurrencySettings currencySettings,MeasureSettings measureSettings,AppConfig appConfig)@@ -74,9 +75,9 @@ namespace Grand.Web.Admin.Controllers_workContext = workContext;_translationService = translationService;_applicationLifetime = applicationLifetime;+ _logger = logger;_appConfig = appConfig;_machineNameProvider = machineNameProvider;- _mediaFileStore = mediaFileStore;}#endregion@@ -271,6 +272,8 @@ namespace Grand.Web.Admin.Controllerspublic async Task<IActionResult> ClearCache(string returnUrl, [FromServices] ICacheBase cacheBase){+ _ = _logger.InsertLog(Domain.Logging.LogLevel.Information, $"Clear cache has been done by the user: {_workContext.CurrentCustomer.Email}");+await cacheBase.Clear();//home page@@ -285,6 +288,8 @@ namespace Grand.Web.Admin.Controllerspublic IActionResult RestartApplication(string returnUrl = ""){+ _ = _logger.InsertLog(Domain.Logging.LogLevel.Information, $"The application has been restarted by the user {_workContext.CurrentCustomer.Email}");+//stop application_applicationLifetime.StopApplication();