// GET: Applicants/Details/5
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var applicant = _applicantRepository.GetApplicantById(id);

            if (applicant == null)
            {
                return(NotFound());
            }

            return(View(applicant));
        }
        public IActionResult GetApplicantById([FromRoute] string id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var applicant = _context.GetApplicantById(id);

            if (applicant == null)
            {
                return(new OkObjectResult("Applicant Information not found for id : " + id));
            }
            return(new OkObjectResult(applicant));
        }
        // GET: Jobs/Details/5
        public IActionResult Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var           job           = _jobRepository.GetJobById(id);
            ApplicantRole applicantRole = new ApplicantRole
            {
                Applicant = _applicantRepository.GetApplicantById(job.ApplicantId),
                Role      = _roleRepository.GetRoleById(job.RoleId)
            };

            if (job == null)
            {
                return(NotFound());
            }

            return(View(applicantRole));
        }
Esempio n. 4
0
        public async Task <IActionResult> GetApplicant(int Id)
        {
            _logger.LogInformation("\t\n\n=========================================================================\n\nAccessing the Endpoint for getting an applicant");
            try
            {
                var applicant = await _appRepository.GetApplicantById(Id);

                if (applicant != null)
                {
                    _logger.LogInformation("Successful Get call was made");
                    return(Ok(new ResponseModel(200, "Success", applicant)));
                }
                _logger.LogInformation("Get call was not successful");
                return(NotFound(new ResponseModel(404, "Applicant does not exist", null)));
            }
            catch (Exception ex)
            {
                _logger.LogInformation("An Error occured in the Get applicant endpoint", ex);
                return(BadRequest(new ResponseModel(400, "Some Error occuredl!!! Please Try again", null)));
            }
        }
 public ApplicantDto GetApplicantById(int id)
 {
     return(_mapper.Map <Applicant, ApplicantDto>(_applicantRepository.GetApplicantById(id)));
 }