diff --git a/projects/Infrastructure/Areas/Admin/Views/Shared/_Layout.cshtml b/projects/Infrastructure/Areas/Admin/Views/Shared/_Layout.cshtml index 882630b0..28a397a2 100644 --- a/projects/Infrastructure/Areas/Admin/Views/Shared/_Layout.cshtml +++ b/projects/Infrastructure/Areas/Admin/Views/Shared/_Layout.cshtml @@ -8,7 +8,7 @@ @(await Html.PartialAsync("_Header")) - name @HtmlTitle + @name @HtmlTitle @RenderSection("styles", required: false) diff --git a/projects/Infrastructure/Views/Shared/_Layout.cshtml b/projects/Infrastructure/Views/Shared/_Layout.cshtml index acf0d4f6..56095e45 100644 --- a/projects/Infrastructure/Views/Shared/_Layout.cshtml +++ b/projects/Infrastructure/Views/Shared/_Layout.cshtml @@ -8,7 +8,7 @@ @(await Html.PartialAsync("_Header")) - name @HtmlTitle + @name @HtmlTitle @RenderSection("styles", required: false) diff --git a/projects/IoT.Shared/Areas/Admin/Controlls/NodeController.cs b/projects/IoT.Shared/Areas/Admin/Controlls/NodeController.cs index 5c232bb4..cae53492 100644 --- a/projects/IoT.Shared/Areas/Admin/Controlls/NodeController.cs +++ b/projects/IoT.Shared/Areas/Admin/Controlls/NodeController.cs @@ -2,9 +2,11 @@ using Application.Domain.Entities; using Application.Models; using Infrastructure.Application; using Infrastructure.Data; +using Infrastructure.Extensions; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System; +using System.Collections.Generic; namespace IoT.Shared.Areas.Admin.Controlls { @@ -20,5 +22,30 @@ namespace IoT.Shared.Areas.Admin.Controlls { return model.Number; } + + public override IActionResult Delete(List list) + { + if (this.isIoTCenter) + { + foreach (var id in list) + { + try + { + this._repo.Delete(this._repo.FindBy(id)); + this._repo.SaveChanges(); + } + catch (Exception ex) + { + ex.PrintStack(); + return RedirectTo(rawMesage: ex.Message); + } + } + return RedirectTo(); + } + else + { + return base.Delete(list); + } + } } } \ No newline at end of file diff --git a/projects/IoT.Shared/Areas/Admin/Controlls/SharedController.cs b/projects/IoT.Shared/Areas/Admin/Controlls/SharedController.cs index fb783c2f..b4d913e1 100644 --- a/projects/IoT.Shared/Areas/Admin/Controlls/SharedController.cs +++ b/projects/IoT.Shared/Areas/Admin/Controlls/SharedController.cs @@ -20,13 +20,13 @@ namespace IoT.Shared.Areas.Admin.Controlls where TEditModel : EditModel where TSearchModel : PagedListModel { - private readonly IServiceProvider _applicationServices; - private readonly bool _isIoTCenter; + protected readonly IServiceProvider applicationServices; + protected readonly bool isIoTCenter; public SharedController(IRepository repo, IServiceProvider applicationServices) : base(repo) { - this._applicationServices = applicationServices; - this._isIoTCenter = Assembly.GetEntryAssembly().GetName().Name.Contains("IoTCenter"); + this.applicationServices = applicationServices; + this.isIoTCenter = Assembly.GetEntryAssembly().GetName().Name.Contains("IoTCenter"); } public override IActionResult Add(TEditModel model) @@ -41,8 +41,8 @@ namespace IoT.Shared.Areas.Admin.Controlls try { var method = $"Edit{typeof(TEntity).Name}"; - using var scope = this._applicationServices.CreateScope(); - if (this._isIoTCenter) + using var scope = this.applicationServices.CreateScope(); + if (this.isIoTCenter) { var group = this.GetNodeNumber(model); this.ToEntity(model, null); @@ -75,8 +75,8 @@ namespace IoT.Shared.Areas.Admin.Controlls try { var method = $"Delete{typeof(TEntity).Name}"; - using var scope = this._applicationServices.CreateScope(); - if (this._isIoTCenter) + using var scope = this.applicationServices.CreateScope(); + if (this.isIoTCenter) { var query = this._repo.ReadOnlyTable(); query = this.Include(query); diff --git a/projects/IoTCenter/IoTCenter.csproj b/projects/IoTCenter/IoTCenter.csproj index 609924c3..fd4bd965 100644 --- a/projects/IoTCenter/IoTCenter.csproj +++ b/projects/IoTCenter/IoTCenter.csproj @@ -2,7 +2,7 @@ netcoreapp3.1 true - 1.0.0-beta.330 + 1.0.0-beta.330.1 diff --git a/projects/StudyCenter/StudyCenter.csproj b/projects/StudyCenter/StudyCenter.csproj index 88b944dc..ce95e18e 100644 --- a/projects/StudyCenter/StudyCenter.csproj +++ b/projects/StudyCenter/StudyCenter.csproj @@ -2,6 +2,7 @@ netcoreapp3.1 true + 1.0.0-beta.330