public void RefreshRobotBehaviorKeyphrases(string _synappsDeviceId, JArray _keyphrases)
        {
            var keyphrases = new List <RobotBehaviorKeyphraseModel>();

            foreach (var t in _keyphrases)
            {
                var model = RobotBehaviorKeyphraseModel.New();
                model.SynAppsDeviceId = _synappsDeviceId;
                model.SynAppsId       = (int)t["Id"];
                model.Keyphrase       = (t["Name"] ?? "").ToString();
                model.KeyphraseReply  = (t["Reply"] ?? "").ToString();
                model.Status          = "Active";
                model.IsSynAppsLinked = true;

                keyphrases.Add(model);
            }

            RobotBehaviorKeyphraseModel.Refresh(_synappsDeviceId, keyphrases);
        }
Esempio n. 2
0
        private static List <RobotBehaviorKeyphraseModel> Build(IQueryable <RobotBehaviorKeyphrase> records)
        {
            var list = new List <RobotBehaviorKeyphraseModel>();

            foreach (var r in records)
            {
                var model = RobotBehaviorKeyphraseModel.New();
                model.Id              = r.Id;
                model.SynAppsId       = r.SynAppsId;
                model.Keyphrase       = r.Keyphrase;
                model.KeyphraseReply  = r.KeyphraseReply;
                model.Status          = r.Status;
                model.IsSynAppsLinked = r.IsSynAppsLinked;

                list.Add(model);
            }

            return(list);
        }
 public Client(string _connectionString)
 {
     RobotBehaviorModel.Connection(_connectionString);
     RobotBehaviorKeyphraseModel.Connection(_connectionString);
 }