private object BuildCommandWebModel(VoiceCommand cmd) { if (cmd == null) return null; return new { Id = cmd.Id, CommandText = cmd.CommandText, ScriptName = Context.GetPlugin<ScriptsPlugin>().GetScript(cmd.UserScript.Id).Name }; }
private object apiAddCommand(HttpRequestParams request) { var text = request.GetRequiredString("text"); var scriptId = request.GetRequiredGuid("scriptId"); using (var session = Context.OpenSession()) { VoiceCommand cmd = new VoiceCommand() { Id = Guid.NewGuid(), CommandText = text, UserScript = Context.GetPlugin<ScriptsPlugin>().GetScript(scriptId) }; session.Save(cmd); session.Flush(); } //NotifyForSignalR(new //{ // MsgId = "SensorNameChanged", // Data = new // { // Id = id, // Name = name // } //}); return null; }