|
|
|
@ -46,23 +46,23 @@ namespace IoTCenter.Controllers
|
|
|
|
|
public IActionResult Index()
|
|
|
|
|
{
|
|
|
|
|
//this._eventPublisher.Publish(new EntityInsertedEvent<Node>(new Node()));
|
|
|
|
|
var temp = this._nodeRepo.Table().Include(o => o.Devices).ThenInclude(o => o.Data).FirstOrDefault(o => o.Name == "207");
|
|
|
|
|
if (!temp.Devices.Any(o => o.Name == "207"))
|
|
|
|
|
{
|
|
|
|
|
temp.Devices.Add(new Device
|
|
|
|
|
{
|
|
|
|
|
Name = "²âÊÔÉ豸",
|
|
|
|
|
Number = "2019091602",
|
|
|
|
|
ProductId = this._productRepo.ReadOnlyTable().FirstOrDefault().Id,
|
|
|
|
|
Data = new List<Data> {
|
|
|
|
|
new Data{
|
|
|
|
|
Key="Electricity",
|
|
|
|
|
Value="659",
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
this._nodeRepo.SaveChanges();
|
|
|
|
|
}
|
|
|
|
|
//var temp = this._nodeRepo.Table().Include(o => o.Devices).ThenInclude(o => o.Data).FirstOrDefault(o => o.Name == "207");
|
|
|
|
|
//if (!temp.Devices.Any(o => o.Name == "207"))
|
|
|
|
|
//{
|
|
|
|
|
// temp.Devices.Add(new Device
|
|
|
|
|
// {
|
|
|
|
|
// Name = "²âÊÔÉ豸",
|
|
|
|
|
// Number = "2019091602",
|
|
|
|
|
// ProductId = this._productRepo.ReadOnlyTable().FirstOrDefault().Id,
|
|
|
|
|
// Data = new List<Data> {
|
|
|
|
|
// new Data{
|
|
|
|
|
// Key="Electricity",
|
|
|
|
|
// Value="659",
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
// });
|
|
|
|
|
// this._nodeRepo.SaveChanges();
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
return View();
|
|
|
|
|
}
|
|
|
|
|