Exemple #1
0
 public async Task <SubmittedDialogResult> IsDialogSubmittedAsync([FromBody] SubmitDialogRequest request)
 {
     return(new SubmittedDialogResult
     {
         Submitted = await _clientDialogsService.IsDialogSubmittedAsync(request.ClientId, request.DialogId, request.ActionId)
     });
 }
Exemple #2
0
        public async Task SubmitDialogAsync([FromBody] SubmitDialogRequest request)
        {
            var dialog = await _clientDialogsService.GetDialogAsync(request.DialogId);

            if (dialog == null)
            {
                throw new ValidationApiException("Dialog not found");
            }

            if (dialog.Actions.All(item => item.Id != request.ActionId))
            {
                throw new ValidationApiException("Action not found");
            }

            var isSubmitted = await _clientDialogsService.IsDialogSubmittedAsync(request.ClientId, request.DialogId, request.ActionId);

            if (isSubmitted)
            {
                throw new ValidationApiException("This dialog is already submitted");
            }

            await _clientDialogsService.SubmitDialogAsync(request.ClientId, request.DialogId, request.ActionId);
        }