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);
        }
        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);
        }
 public Task Remove(GatewayModel gateway)
 {
     gateways.Remove(gateway);
     return(Task.CompletedTask);
 }