You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
1.4 KiB
51 lines
1.4 KiB
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
|
|
{
|
|
[Authorize]
|
|
[Area(nameof(Admin))]
|
|
public class NodeController : SharedController<Node, PagedListModel<EditNodeModel>, EditNodeModel, EditNodeModel>
|
|
{
|
|
public NodeController(IRepository<Node> repo, IServiceProvider sp) : base(repo, sp)
|
|
{
|
|
}
|
|
|
|
public override string GetNodeNumber(EditNodeModel model)
|
|
{
|
|
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);
|
|
}
|
|
}
|
|
}
|
|
} |