解决_Layout.cshtml中标题显示错误的问题

添加IoTCenter可以直接删除Node的功能


Former-commit-id: b265fb07db5e8ffef19e1e919a90f3351a7d72c3
TangShanKaiPing
wanggang 5 years ago
parent eb74be5777
commit 4964991626

@ -8,7 +8,7 @@
<html> <html>
<head> <head>
@(await Html.PartialAsync("_Header")) @(await Html.PartialAsync("_Header"))
<title>name @HtmlTitle</title> <title>@name @HtmlTitle</title>
@RenderSection("styles", required: false) @RenderSection("styles", required: false)
</head> </head>
<body class="hold-transition sidebar-mini layout-fixed"> <body class="hold-transition sidebar-mini layout-fixed">

@ -8,7 +8,7 @@
<html> <html>
<head> <head>
@(await Html.PartialAsync("_Header")) @(await Html.PartialAsync("_Header"))
<title>name @HtmlTitle</title> <title>@name @HtmlTitle</title>
@RenderSection("styles", required: false) @RenderSection("styles", required: false)
</head> </head>
<body class="hold-transition layout-top-nav"> <body class="hold-transition layout-top-nav">

@ -2,9 +2,11 @@ using Application.Domain.Entities;
using Application.Models; using Application.Models;
using Infrastructure.Application; using Infrastructure.Application;
using Infrastructure.Data; using Infrastructure.Data;
using Infrastructure.Extensions;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using System; using System;
using System.Collections.Generic;
namespace IoT.Shared.Areas.Admin.Controlls namespace IoT.Shared.Areas.Admin.Controlls
{ {
@ -20,5 +22,30 @@ namespace IoT.Shared.Areas.Admin.Controlls
{ {
return model.Number; return model.Number;
} }
public override IActionResult Delete(List<Guid> 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);
}
}
} }
} }

@ -20,13 +20,13 @@ namespace IoT.Shared.Areas.Admin.Controlls
where TEditModel : EditModel where TEditModel : EditModel
where TSearchModel : PagedListModel<TDisplayModel> where TSearchModel : PagedListModel<TDisplayModel>
{ {
private readonly IServiceProvider _applicationServices; protected readonly IServiceProvider applicationServices;
private readonly bool _isIoTCenter; protected readonly bool isIoTCenter;
public SharedController(IRepository<TEntity> repo, IServiceProvider applicationServices) : base(repo) public SharedController(IRepository<TEntity> repo, IServiceProvider applicationServices) : base(repo)
{ {
this._applicationServices = applicationServices; this.applicationServices = applicationServices;
this._isIoTCenter = Assembly.GetEntryAssembly().GetName().Name.Contains("IoTCenter"); this.isIoTCenter = Assembly.GetEntryAssembly().GetName().Name.Contains("IoTCenter");
} }
public override IActionResult Add(TEditModel model) public override IActionResult Add(TEditModel model)
@ -41,8 +41,8 @@ namespace IoT.Shared.Areas.Admin.Controlls
try try
{ {
var method = $"Edit{typeof(TEntity).Name}"; var method = $"Edit{typeof(TEntity).Name}";
using var scope = this._applicationServices.CreateScope(); using var scope = this.applicationServices.CreateScope();
if (this._isIoTCenter) if (this.isIoTCenter)
{ {
var group = this.GetNodeNumber(model); var group = this.GetNodeNumber(model);
this.ToEntity(model, null); this.ToEntity(model, null);
@ -75,8 +75,8 @@ namespace IoT.Shared.Areas.Admin.Controlls
try try
{ {
var method = $"Delete{typeof(TEntity).Name}"; var method = $"Delete{typeof(TEntity).Name}";
using var scope = this._applicationServices.CreateScope(); using var scope = this.applicationServices.CreateScope();
if (this._isIoTCenter) if (this.isIoTCenter)
{ {
var query = this._repo.ReadOnlyTable(); var query = this._repo.ReadOnlyTable();
query = this.Include(query); query = this.Include(query);

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<Version>1.0.0-beta.330</Version> <Version>1.0.0-beta.330.1</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" /> <ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />

@ -2,6 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch> <TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<Version>1.0.0-beta.330</Version>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<ProjectReference Include="..\Infrastructure\Infrastructure.csproj" /> <ProjectReference Include="..\Infrastructure\Infrastructure.csproj" />

Loading…
Cancel
Save