コード例 #1
0
        public Application Apply(Applicant.Applicant applicant)
        {
            if (!IsOpen)
            {
                throw new ValidationException("It's not possible to apply to a closed opening.");
            }

            return(new Application(applicant.Id, Id));
        }
コード例 #2
0
ファイル: OpeningApplicator.cs プロジェクト: pedroballona/ats
        public async Task <Application> ApplyToOpening(Applicant.Applicant applicant, Opening opening)
        {
            if (await _applicationRepository.HasAlreadyApplied(applicant, opening))
            {
                throw new ValidationException("You already applied to this opening.");
            }

            var application = opening.Apply(applicant);
            await _applicationRepository.CreateAsync(application);

            return(application);
        }