Пример #1
0
 public static DataDTO Convert(Data from)
 {
     DataTypeDTO t = new DataTypeDTO();
     t.Id = 1;
     t.Name = "Temperature";
     DataDTO res = new DataDTO();
     res.Id = from.Id;
     res.Name = from.Name;
     res.Timestamp = from.Timestamp;
     res.Value = from.Value;
     res.Type = t;
     return res;
 }
Пример #2
0
        public static DataDTO Convert(Data from)
        {
            DataTypeDTO t = new DataTypeDTO();

            t.Id   = 1;
            t.Name = "Temperature";
            DataDTO res = new DataDTO();

            res.Id        = from.Id;
            res.Name      = from.Name;
            res.Timestamp = from.Timestamp;
            res.Value     = from.Value;
            res.Type      = t;
            return(res);
        }
Пример #3
0
        public static DeviceDTO Convert(Device from)
        {
            DeviceDTO res = new DeviceDTO();

            res.Id      = from.Id;
            res.Name    = from.Name;
            res.Working = from.Working;

            res.Datas = new List <DataDTO>();
            foreach (Data d in from.Data)
            {
                res.Datas.Add(DataDTO.Convert(d));
            }

            res.Commands = new List <CommandDTO>();
            foreach (Command c in from.Command)
            {
                res.Commands.Add(CommandDTO.Convert(c));
            }

            return(res);
        }