コード例 #1
0
        public MediatorResponse <TraineeshipApplicationViewModel> ReviewSetToSubmitted(
            TraineeshipApplicationViewModel traineeshipApplicationViewModel)
        {
            var validationResult =
                _traineeshipApplicationViewModelServerValidator.Validate(traineeshipApplicationViewModel);

            if (!validationResult.IsValid)
            {
                return(GetMediatorResponse(
                           TraineeshipApplicationMediatorCodes.ReviewSaveAndContinue.FailedValidation,
                           traineeshipApplicationViewModel, validationResult));
            }

            try
            {
                _applicationProvider.UpdateTraineeshipApplicationViewModelNotes(
                    traineeshipApplicationViewModel.ApplicationSelection.ApplicationId,
                    traineeshipApplicationViewModel.Notes, false);
                _applicationProvider.SetTraineeshipStateSubmitted(traineeshipApplicationViewModel.ApplicationSelection);
                return(GetMediatorResponse(TraineeshipApplicationMediatorCodes.ReviewSaveAndContinue.Ok,
                                           traineeshipApplicationViewModel));
            }
            catch (Exception)
            {
                var viewModel =
                    GetFailedUpdateTraineeshipApplicationViewModel(
                        traineeshipApplicationViewModel.ApplicationSelection);
                return(GetMediatorResponse(TraineeshipApplicationMediatorCodes.ReviewSaveAndContinue.Error, viewModel,
                                           ApplicationViewModelMessages.UpdateNotesFailed, UserMessageLevel.Error));
            }
        }