|
|
|
@ -1,8 +1,10 @@
|
|
|
|
|
using Infrastructure.Application;
|
|
|
|
|
using Application.Domain.Entities;
|
|
|
|
|
using Infrastructure.Application;
|
|
|
|
|
using Infrastructure.Data;
|
|
|
|
|
using Infrastructure.Domain;
|
|
|
|
|
using Infrastructure.Events;
|
|
|
|
|
using Infrastructure.Extensions;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
@ -84,6 +86,13 @@ namespace IoT.Shared.Services
|
|
|
|
|
entity.From(model);
|
|
|
|
|
if (repo.SaveChanges() > 0)
|
|
|
|
|
{
|
|
|
|
|
if (entity is Data)
|
|
|
|
|
{
|
|
|
|
|
var data = entity as Data;
|
|
|
|
|
data.Device = scope.ServiceProvider.GetService<IRepository<Device>>().ReadOnlyTable().Include(o => o.Node)
|
|
|
|
|
.Where(o => o.Id == data.DeviceId)
|
|
|
|
|
.Select(o => new Device { DisplayName = o.DisplayName, Node = new Node { Name = o.Node.Name } }).FirstOrDefault();
|
|
|
|
|
}
|
|
|
|
|
var eventPublisher = scope.ServiceProvider.GetService<IEventPublisher>();
|
|
|
|
|
if (isNew)
|
|
|
|
|
{
|
|
|
|
|