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

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

Loading…
Cancel
Save