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

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


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

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

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

@ -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<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 TSearchModel : PagedListModel<TDisplayModel>
{
private readonly IServiceProvider _applicationServices;
private readonly bool _isIoTCenter;
protected readonly IServiceProvider applicationServices;
protected readonly bool isIoTCenter;
public SharedController(IRepository<TEntity> 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);

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

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

Loading…
Cancel
Save