public async Task <ActionResult> Manage(IntentManageVM vm) { string authoringKey = ConfigurationManager.AppSettings["AuthoringKey"].ToString(); string appID = ConfigurationManager.AppSettings["LuisAppID"].ToString(); string appVersion = ConfigurationManager.AppSettings["AppVersion"].ToString(); string appHost = ConfigurationManager.AppSettings["LuisHost"].ToString(); if (vm.SaveMode == SaveModes.Create) { vm.Intent.ModifyUserID = "eddy";//HttpContext.User.Identity.Name; vm.Intent.ModifyDate = DateTime.Now; //LUIS 인텐트 추가 string intentID = await LuisCreateIntent(appID, appVersion, authoringKey, vm.Intent); vm.Intent.LuisAppID = appID; vm.Intent.IntentID = intentID; //인텐트 DB 등록 intentService.AddIntent(vm.Intent); } else { //인텐트 정보 DB 조회 var dbIntent = intentService.GetIntentInfo(vm.Intent.IntentIDX); //인텐트 아이디가 없으면 신규 LUIS 인텐트 등록처리 if (string.IsNullOrEmpty(vm.Intent.IntentID)) { string intentID = await LuisCreateIntent(appID, appVersion, authoringKey, vm.Intent); vm.Intent.LuisAppID = appID; vm.Intent.IntentID = intentID; } //인텐트 명 변경된 경우 수정처리 if (vm.Intent.IntentName != dbIntent.IntentName) { await LuisModifyIntent(appID, appVersion, authoringKey, vm.Intent); } vm.Intent.ModifyUserID = HttpContext.User.Identity.Name; vm.Intent.ModifyDate = DateTime.Now; intentService.UpdateIntent(vm.Intent); } return(RedirectToAction("List", "Intent")); }
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)); }