コード例 #1
0
        private CertificationRM CreateCertificationForOperatingContext(Commands.V1.OperatingContext.Certification.CreateForOperatingContext cmd)
        {
            Certification certification = Certification.Create(_certifications++, cmd.CertificationStatusId, cmd.CertificationDateTime,
                                                               cmd.DecertificationDateTime, cmd.IsInherited, cmd.OperatingContextId);

            if (_repository.CertificationExistsForOperatingContext(certification, cmd.OperatingContextId))
            {
                throw new InvalidOperationException($"Certification already exists for Operating Context {cmd.OperatingContextId}");
            }

            _repository.AddCertificationForOperatingContext(certification, cmd.OperatingContextId);

            return(Conversions.GetCertificationRM(certification));
        }