public void RefreshRobotBehaviors(string _synappsDeviceId, JArray tasks)
        {
            var behaviors = new List <RobotBehaviorModel>();

            foreach (var t in tasks)
            {
                var model = RobotBehaviorModel.New();
                model.SynAppsDeviceId = _synappsDeviceId;
                model.SynAppsId       = (int)t["Id"];
                model.Status          = "Active";
                model.ActionType      = (t["ActionType"] ?? "").ToString();
                model.ActionBody      = JsonConvert.SerializeObject(t);
                model.IsSynAppsLinked = true;

                behaviors.Add(model);
            }

            RobotBehaviorModel.Refresh(_synappsDeviceId, behaviors);
        }
Example #2
0
        private static List <RobotBehaviorModel> Build(IQueryable <RobotBehavior> records)
        {
            List <RobotBehaviorModel> list = new List <RobotBehaviorModel>();

            foreach (var r in records)
            {
                var model = RobotBehaviorModel.New();
                model.Id              = r.Id;
                model.SynAppsId       = r.SynAppsId;
                model.Status          = r.Status;
                model.ActionType      = r.ActionType;
                model.ActionBody      = r.ActionBody;
                model.IsSynAppsLinked = r.IsSynAppsLinked;

                list.Add(model);
            }

            return(list);
        }