Пример #1
0
 /// <inheritdoc />
 protected override async Task ExecuteAsync(MainWindowDialogModel?viewModel, object?parameter)
 {
     if (viewModel != null)
     {
         await _viewModelService.UpdateViewModelAsync(viewModel);
     }
 }
Пример #2
0
        /// <inheritdoc />
        protected override async Task ExecuteAsync(MainWindowDialogModel?viewModel, object?parameter)
        {
            if (viewModel == null)
            {
                return;
            }

            var dialogModel = _viewModelService.CreateViewModel <ApplicationDialogModel>(viewModel);

            do
            {
                if (_dialogService.ShowDialog(dialogModel) != true)
                {
                    return;
                }

                if (!dialogModel.IsValid)
                {
                    _dialogService.ShowErrorDialog(Strings.DialogInputNotValid, Strings.Error);
                }
            } while (!dialogModel.IsValid);

            await _viewModelService.SaveViewModelAsync(dialogModel);

            await _viewModelService.UpdateViewModelAsync(viewModel);
        }
Пример #3
0
        public async Task <IActionResult> Edit([Required] ViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }
            var saveResult = await _viewModelService.UpdateViewModelAsync(model);

            if (saveResult.IsSuccess)
            {
                return(RedirectToAction("Index"));
            }
            ModelState.AppendResultModelErrors(saveResult.Errors);
            return(View(model));
        }
Пример #4
0
        /// <inheritdoc />
        protected override async Task ExecuteAsync(ApplicationViewModel?viewModel, object?parameter)
        {
            if (viewModel == null)
            {
                return;
            }

            var dialogModel = _viewModelService.CreateViewModel <ApplicationDialogModel>(viewModel);

            if (_dialogService.ShowDialog(dialogModel) != true)
            {
                return;
            }

            await _viewModelService.SaveViewModelAsync(dialogModel);

            await _viewModelService.UpdateViewModelAsync(viewModel);
        }