Exemplo n.º 1
0
        public async Task <ActionResult> Create(UtteranceManageVM vm)
        {
            Intents intent = intentService.GetIntentInfo(Convert.ToInt32(vm.Utterance.IntentIDX));

            string authoringKey = ConfigurationManager.AppSettings["AuthoringKey"].ToString();
            string appID        = ConfigurationManager.AppSettings["LuisAppID"].ToString();
            string appVersion   = ConfigurationManager.AppSettings["AppVersion"].ToString();
            string appHost      = ConfigurationManager.AppSettings["LuisHost"].ToString();


            vm.Utterance.IsUseYN      = true;
            vm.Utterance.RegistUserID = "eddy"; //HttpContext.User.Identity.Name;
            vm.Utterance.RegistDate   = DateTime.Now;
            vm.Utterance.ModifyUserID = "eddy"; //HttpContext.User.Identity.Name;
            vm.Utterance.ModifyDate   = DateTime.Now;

            //LUIS 해당 인텐트에 발화메시지 등록처리
            Example example = new Example();

            example.IntentName = intent.IntentName;
            example.Text       = vm.Utterance.Utterance;
            Utterance utterance = await LuisCreateUtterance(appID, appVersion, authoringKey, example);

            //발화메시지 DB저장
            vm.Utterance.ExampleID = utterance.ExampleId;
            intentService.AddUtterance(vm.Utterance);

            return(RedirectToAction("List", "Utterance"));
        }
        public ActionResult Manage(int?idx)
        {
            IntentManageVM vm = new IntentManageVM();

            vm.Intent         = new Intents();
            vm.Intent.IsUseYN = true;
            vm.SaveMode       = SaveModes.Create;

            if (idx != null)
            {
                vm.Intent         = intentService.GetIntentInfo((int)idx);
                vm.Intent.IsUseYN = true;
                vm.SaveMode       = SaveModes.Modify;
            }

            return(View(vm));
        }