Ejemplo n.º 1
0
        /// <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);
        }
Ejemplo n.º 2
0
 public ServiceResponseDTO <ApplicantsDTO> Put(int id, [FromBody] ApplicantsDTO value)
 {
     return(_applicantsService.UpdateApplicant(value));
 }
Ejemplo n.º 3
0
 public ServiceResponseDTO <ApplicantsDTO> Post([FromBody] ApplicantsDTO value)
 {
     return(_applicantsService.AddApplicant(value));
 }