private async Task <DialogTurnResult> AnswerToChoiceDialog(WaterfallStepContext stepContext, CancellationToken cancellationToken) { var scenarioId = (string)stepContext.Result; var userId = new UserId(stepContext.Context.Activity); // сделаем проверку чего ввел пльзователь if (scenarioId == null || !_scenarioService.IsExist(scenarioId) || // существует ли сценарий await _scenarioService.IsOverByUserAsync(userId, scenarioId)) // сценарий уже закончен пользователем { // если такого сценария не существует, выведим список еще раз await stepContext.CancelAllDialogsAsync(cancellationToken); return(await stepContext.BeginDialogAsync(nameof(ScenarioListDialog), userId, cancellationToken)); } var scenarioDetails = await _scenarioService.GetLastScenarioDetailsExceptGameOver(userId, scenarioId); if (scenarioDetails == null) { scenarioDetails = new ScenarioDetails { ScenarioId = scenarioId, UserId = userId } } ; //var scenarioDetails = _scenarioService.GetLastScenarioDetailsExceptGameOver(teamId, null); var replyMessage = $"Выбранный сценарий: {scenarioId}"; var reply = stepContext.Context.Activity.CreateReply(replyMessage); GenerateHideKeybordMarkupForTelegram(reply); await stepContext.Context.SendActivityAsync(reply, cancellationToken); //await TeamUtils.SendTeamMessage(_teamService, stepContext.Context, _notificationMessanger, teamId, //replyMessage, _conversationReferences, cancellationToken, false); return(await stepContext.BeginDialogAsync(nameof(ScenarioDialog), scenarioDetails, cancellationToken)); }
public async Task SetAnswer(ScenarioDetails scenarioDetails) { await _answerRepository.AddAnswer(new Answer(scenarioDetails)); }