コード例 #1
0
        public Task Add(GatewayModel gateway)
        {
            gateway.Devices = gateway.Devices ?? new List <DeviceModel>();
            gateway.History = gateway.History ?? new List <GatewayHistoryModel>();

            gateways.Add(gateway);
            return(Task.CompletedTask);
        }
コード例 #2
0
        public Task Update(GatewayModel gateway)
        {
            var gatewayrepo = gateways.FirstOrDefault(o => o.Id == gateway.Id);

            if (gatewayrepo != null)
            {
                gatewayrepo.Ip                 = gateway.Ip;
                gatewayrepo.IsActive           = gateway.IsActive;
                gatewayrepo.LastConnectionDate = gateway.LastConnectionDate;
                gatewayrepo.Value              = gateway.Value;
                gatewayrepo.Name               = gateway.Name;
                gatewayrepo.LastValueDate      = gateway.LastValueDate;
            }

            return(Task.CompletedTask);
        }
コード例 #3
0
 public Task Remove(GatewayModel gateway)
 {
     gateways.Remove(gateway);
     return(Task.CompletedTask);
 }