Beispiel #1
0
        public async Task MarkConnectionAsClosed(DeviceConnectionEntity deviceConnection)
        {
            using IUnitOfWork unitOfWork = repository.CreateUnitOfWork();

            deviceConnection.ClosedAt = DateTime.UtcNow;

            unitOfWork.Update(deviceConnection);

            await unitOfWork.SaveChanges();
        }
Beispiel #2
0
        public async Task <DeviceConnectionEntity> NewConnection(string endPoint, int protocolPort)
        {
            using IUnitOfWork unitOfWork = repository.CreateUnitOfWork();

            DeviceConnectionEntity deviceConnection = new DeviceConnectionEntity
            {
                OpenedAt       = DateTime.UtcNow,
                RemoteEndPoint = endPoint,
                ProtocolPort   = protocolPort
            };

            unitOfWork.Add(deviceConnection);

            await unitOfWork.SaveChanges();

            return(deviceConnection);
        }