Пример #1
0
 private void ValidateContract(UpdateSkillContract contract)
 {
     try
     {
         _updateSkillContractValidator.ValidateAndThrow(contract,
                                                        $"{ValidatorConstants.RULESET_DEFAULT}");
     }
     catch (ValidationException ex)
     {
         throw new CreateContractInvalidException(ex.ToListOfMessages());
     }
 }
Пример #2
0
        public void Update(UpdateSkillContract contract)
        {
            _log.LogInformation($"Validating contract {contract.Name}");
            ValidateContract(contract);
            ValidateExistence(contract.Id, contract.Name);

            _log.LogInformation($"Mapping contract {contract.Name}");
            var skill = _mapper.Map <Skill>(contract);

            this.AddTypeToSkill(skill, contract.Type);

            var updatedSkill = _skillRepository.Update(skill);

            _log.LogInformation($"Complete for {contract.Name}");
            _unitOfWork.Complete();
        }