コード例 #1
0
        public async Task <IActionResult> Get()
        {
            var applicants = await _repo.Get();

            var applicantsDto = _mapper.Map <IList <ApplicantDTO> >(applicants);

            return(Ok(applicantsDto));
        }
コード例 #2
0
        public async Task <IActionResult> DeleteApplicant(int id)
        {
            Applicants Applicant = await _repo.Get(id);

            _repo.RemoveApplicant(Applicant);
            await _unitofwork.CompleteAsync();

            return(Ok(id));
        }
コード例 #3
0
        public async Task UpdateApplicant(UpdateApplicantCommand command)
        {
            var applicant = await _applicantRepository.Get(command.Id);

            var modifiedApplicant = Applicant.Instance(applicant, _countryService)
                                    .WithName(command.Name)
                                    .WithFamily(command.Family)
                                    .WithAddress(command.Address)
                                    .WithCountryOfOrigin(command.CountryOfOrigin)
                                    .WithEmailAddress(command.EmailAddress)
                                    .WithAge(command.Age)
                                    .WithHired(command.Hired)
                                    .Build();
            await _applicantRepository.Update(modifiedApplicant);
        }
コード例 #4
0
        public async Task <ApplicantDto> Get(int userId)
        {
            var result = await _applicant.Get(userId);

            int?countryId;

            if (result.StateId != null)
            {
                countryId = await _applicant.GetCountryId(result.StateId);
            }
            else
            {
                countryId = null;
            }
            var applicantDetail = new ApplicantDto
            {
                Id          = result.Id,
                FirstName   = result.FirstName,
                LastName    = result.LastName,
                Email       = result.Email,
                DateOfBirth = result.DateOfBirth,
                Country     = countryId,
                State       = result.StateId,
                Disabled    = result.Disabled,
                Address     = result.Address,
                City        = result.City,
                PostalCode  = result.PostalCode,
                Mobile      = result.Mobile,
                Phone       = result.Phone
            };

            return(applicantDetail);
        }
コード例 #5
0
        public async Task <long> GetScoreOfApplicant(long applicantId)
        {
            var applicant = await _applicantRepository.Get(applicantId);

            var activeRules = await _ruleRepository.GetActiveRules();

            return(activeRules.Sum(a => a.GetPointsFor(applicant)));
        }
コード例 #6
0
 public Applicant Get(int id)
 {
     try
     {
         return(_applicantRepository.Get(id).Result);
     }
     catch (Exception e)
     {
         throw;
     }
 }
コード例 #7
0
        public void Create(Applicant applicant)
        {
            if (applicant == null)
            {
                throw new ValidationFailedException
                          (new[] { $"{nameof(applicant)} is null or empty" });
            }

            if (!validator.Validate(applicant, out IEnumerable <string> errors))
            {
                throw new ValidationFailedException(errors);
            }

            var present = repo.Get(applicant.ID) != null;

            if (present)
            {
                throw new ApplicantAlreadyExistsException(applicant);
            }

            repo.Add(applicant);
        }
コード例 #8
0
 public object GetApplicants()
 {
     return(_serializer.Serialize(_repository.Get(), _accessor));
 }
コード例 #9
0
 public Applicant Get(int id)
 {
     _logger.LogInformation("Executing {0} service method for applicant {1}.", nameof(Get), id);
     return(_repository.Get(id));
 }
コード例 #10
0
 public async Task <ApplicantViewModel> Get(int id)
 {
     return(await _applicantRepository.Get(id));
 }
コード例 #11
0
ファイル: ApplicantService.cs プロジェクト: wkk91193/Hahn
        public Applicant Get(int applicantId)
        {
            var result = _repository.Get(applicantId);

            return(result);
        }
コード例 #12
0
 public object Get()
 {
     return(_repository.Get());
 }