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.
55 lines
1.7 KiB
55 lines
1.7 KiB
using Infrastructure.Application.Services.Settings;
|
|
using Infrastructure.Data;
|
|
using Infrastructure.Extensions;
|
|
using Infrastructure.Web;
|
|
using IoT.Shared.Services;
|
|
using IoT.Shared.Application.Domain.Entities;
|
|
using Microsoft.AspNetCore.Authorization;
|
|
using Microsoft.AspNetCore.Mvc;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using System.Linq;
|
|
|
|
namespace IoTNode.Controllers
|
|
{
|
|
//[Device]
|
|
public class HomeController : BaseController
|
|
{
|
|
private readonly ISettingService _settingService;
|
|
private readonly IRepository<IoTGateway> _iotGatewayRepo;
|
|
//private readonly IRepository<IoTScene> _sceneRepo;
|
|
private readonly IoTNodeClient _ioTNodeClient;
|
|
|
|
public HomeController(ISettingService settingService, IRepository<IoTGateway> iotGatewayRepo,
|
|
//IRepository<IoTScene> sceneRepo,
|
|
IoTNodeClient ioTNodeClient)
|
|
{
|
|
this._settingService = settingService;
|
|
this._iotGatewayRepo = iotGatewayRepo;
|
|
//this._sceneRepo = sceneRepo;
|
|
this._ioTNodeClient = ioTNodeClient;
|
|
}
|
|
|
|
[Authorize]
|
|
public IActionResult Index()
|
|
{
|
|
var model = this._iotGatewayRepo.ReadOnlyTable()
|
|
//.Include(o => o.Scenes)
|
|
.Include(o => o.Devices)
|
|
.ThenInclude(o => o.Product)
|
|
.FirstOrDefault();
|
|
return View(model);
|
|
}
|
|
|
|
public IActionResult Upload()
|
|
{
|
|
this._ioTNodeClient.OnConnected();
|
|
return RedirectTo();
|
|
}
|
|
|
|
public IActionResult GetVersion()
|
|
{
|
|
return Content(Helper.Instance.GetVersion());
|
|
}
|
|
}
|
|
}
|