public async Task <ActionResult> Edit(QnAKBEntity entity) { entity.RowKey = entity.QnAKBID; await _tableWrapper.Delete <QnAKBEntity>(entity); await _tableWrapper.Insert <QnAKBEntity>(entity); return(RedirectToAction("Index", new { id = entity.PartitionKey })); }
public async Task <ActionResult> Edit(LuisEntity entity) { entity.PartitionKey = LuisEntity.STR_PARTITION_KEY; entity.RowKey = entity.AppId; await _tableWrapper.Delete <LuisEntity>(entity); await _tableWrapper.Insert <LuisEntity>(entity); return(RedirectToAction("Index")); }
/// <summary> /// Inicializador do gerenciador do LUIS /// </summary> /// <returns></returns> public async Task InitAsync() { //seta o AppID LuisAppId = ConfigurationManager.AppSettings["LuisAppId"]; //Testa se existe if (String.IsNullOrEmpty(LuisAppId)) { throw new ArgumentNullException("LuisAppId", "Cahve do web.config LuisAppId nao prenchida"); } //recuera a entidade do tables com as configuracoes do LUIS var luisEntity = await table.Get <LuisEntity>(LuisEntity.STR_PARTITION_KEY, LuisAppId); //verifica se existe if (luisEntity == null) { throw new ArgumentNullException("luisEntity", "Nao existe configuracao para esse AppId do LUIS"); } //recupera o NOME LuisNome = luisEntity.Nome; //Recupera a App Key LuisApiKey = luisEntity.ApiKey; //Recupera ao Host Region LuisHostRegion = luisEntity.HostRegion; //recupera as KB relacionadas a esse LUIS AppID var luisKBs = await table.List <QnAKBEntity>(LuisAppId); //percorre a lista de KBs foreach (var luisKB in luisKBs) { try { //Adiciona ao dicionario os servicos QnaService.Add ( luisKB.LuisIntent, new QnAMakerService ( "https://" + luisKB.QnADomain + ".azurewebsites.net", luisKB.QnAKBID, luisKB.QnAEndPointKey ) ); } catch (Exception) { await table.Delete <QnAKBEntity>(luisKB); } } }