Ejemplo n.º 1
0
        public async Task AssignDialogToClientAsync([FromBody] AssignDialogRequest request)
        {
            var dialog = await _clientDialogsService.GetDialogAsync(request.DialogId);

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

            await _clientDialogsService.AssignDialogToClientAsync(request.ClientId, request.DialogId);
        }
Ejemplo n.º 2
0
        public async Task <DialogModel> AddDialogAsync([FromBody][CustomizeValidator(RuleSet = "new")] DialogModel model)
        {
            if (!string.IsNullOrEmpty(model.Id))
            {
                var existingDialog = await _clientDialogsService.GetDialogAsync(model.Id);

                if (existingDialog != null)
                {
                    throw new ValidationApiException("Dialog is already exists, use update method to change this dialog");
                }
            }

            IClientDialog dialog = Mapper.Map <ClientDialog>(model);
            var           result = await _clientDialogsService.AddDialogAsync(dialog);

            return(Mapper.Map <DialogModel>(result));
        }