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.
127 lines
3.5 KiB
127 lines
3.5 KiB
using Application.Domain.Entities;
|
|
using Infrastructure.Data;
|
|
using Infrastructure.Extensions;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.Extensions.Configuration;
|
|
using System;
|
|
using System.Linq;
|
|
|
|
namespace IoTCenter.Controllers
|
|
{
|
|
[Authorize]
|
|
//[Device]
|
|
[ApiExplorerSettings(IgnoreApi = true)]
|
|
public class HomeController : Controller
|
|
{
|
|
private readonly IConfiguration _cfg;
|
|
private readonly IRepository<OrganScene> _organSceneRepo;
|
|
private readonly IRepository<Area> _areaRepo;
|
|
|
|
public HomeController(
|
|
IConfiguration cfg,
|
|
IRepository<OrganScene> organSceneRepo, IRepository<Area> areaRepo)
|
|
{
|
|
this._cfg = cfg;
|
|
this._organSceneRepo = organSceneRepo;
|
|
this._areaRepo = areaRepo;
|
|
}
|
|
|
|
[AllowAnonymous]
|
|
public IActionResult RedirectTo(string url)
|
|
{
|
|
Response.Headers.Remove("Referer");
|
|
return Redirect(url);
|
|
}
|
|
|
|
[AllowAnonymous]
|
|
public IActionResult Index()
|
|
{
|
|
//this._areaRepo.Add(new Area
|
|
//{
|
|
// Name = "root",
|
|
// Number = "root",
|
|
// Children = new List<Area> {
|
|
// new Area{
|
|
// Name="1",
|
|
// Number="1",
|
|
// DisplayOrder=0,
|
|
// Children=new List<Area>
|
|
// {
|
|
// new Area{
|
|
// Name="11",
|
|
// Number="11",
|
|
// DisplayOrder=0,
|
|
// },
|
|
// new Area{
|
|
// Name="13",
|
|
// Number="14",
|
|
// DisplayOrder=1
|
|
// }
|
|
// }
|
|
// },
|
|
// new Area{
|
|
// Name="2",
|
|
// Number="2",
|
|
// DisplayOrder=1,
|
|
// Children=new List<Area>
|
|
// {
|
|
// new Area{
|
|
// Name="21",
|
|
// Number="22",
|
|
// DisplayOrder=0,
|
|
// },
|
|
// new Area{
|
|
// Name="23",
|
|
// Number="24",
|
|
// DisplayOrder=1
|
|
// }
|
|
// }
|
|
// }
|
|
// }
|
|
//});
|
|
//this._areaRepo.SaveChanges();
|
|
var root = _areaRepo.Table()
|
|
.ToList()
|
|
.FirstOrDefault(o => o.Name == "root");
|
|
return View();
|
|
}
|
|
|
|
public IActionResult Product()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public IActionResult Device(string productNumber)
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public IActionResult Nodes()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
public IActionResult Node()
|
|
{
|
|
return View();
|
|
}
|
|
|
|
[Route("/Device")]
|
|
public IActionResult Device(Guid id)
|
|
{
|
|
return View();
|
|
}
|
|
|
|
#if DEBUG
|
|
|
|
[Route("/license")]
|
|
[AllowAnonymous]
|
|
public IActionResult License(string mac)
|
|
{
|
|
return Content(Helper.Instance.MacEncrypt(mac));
|
|
}
|
|
|
|
#endif
|
|
}
|
|
} |