/// <summary> /// Add Applicant /// </summary> /// <param name="applicant"></param> /// <returns></returns> public ServiceResponseDTO <ApplicantsDTO> AddApplicant(ApplicantsDTO applicant) { var result = new ServiceResponseDTO <ApplicantsDTO>(); try { var _applicant = Mapper.Map <Applicant>(applicant); var valid = _applicantsRepository.Validate(_applicant); if (valid) { applicant = Mapper.Map <ApplicantsDTO>(_applicantsRepository.AddApplicant(_applicant)); applicant.Id = _applicant.Id; applicant.StatusType = Enum.GetName(typeof(ApplicantStatusType), applicant.Status); result.ResponseData = applicant; } else { result.ResponseData = null; } result.Success = true; } catch (Exception ex) { result.Errors = new List <string>() { ex.Message }; result.Success = false; } return(result); }
public ServiceResponseDTO <ApplicantsDTO> Put(int id, [FromBody] ApplicantsDTO value) { return(_applicantsService.UpdateApplicant(value)); }
public ServiceResponseDTO <ApplicantsDTO> Post([FromBody] ApplicantsDTO value) { return(_applicantsService.AddApplicant(value)); }