Former-commit-id: 90463c7e4efbb05edfc788779475df71f1654151
TangShanKaiPing
wanggang 6 years ago
parent 9a0be84b7b
commit ab66e0e1e5

@ -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();
}

Loading…
Cancel
Save