protected override async Task HandleCore(ReviewApprenticeshipUpdateCommand command) { var validationResult = _validator.Validate(command); if (!validationResult.IsValid()) { throw new ValidationException("Validation failed"); } await _commitmentsApi.PatchApprenticeshipUpdate(command.AccountId, command.ApprenticeshipId, new ApprenticeshipUpdateSubmission { UpdateStatus = command.IsApproved ? ApprenticeshipUpdateStatus.Approved : ApprenticeshipUpdateStatus.Rejected, UserId = command.UserId, LastUpdatedByInfo = new LastUpdateInfo { EmailAddress = command.UserEmailAddress, Name = command.UserDisplayName } }); }
protected override async Task HandleCore(UndoApprenticeshipUpdateCommand command) { var validationResult = _validator.Validate(command); if (!validationResult.IsValid()) { throw new ValidationException(validationResult.ValidationDictionary.FirstOrDefault().Value); } var submission = new ApprenticeshipUpdateSubmission { UpdateStatus = ApprenticeshipUpdateStatus.Deleted, UserId = command.UserId, LastUpdatedByInfo = new LastUpdateInfo { EmailAddress = command.UserEmailAddress, Name = command.UserDisplayName } }; await _commitmentsApi.PatchApprenticeshipUpdate(command.AccountId, command.ApprenticeshipId, submission); }