Ejemplo n.º 1
0
        public async Task <ResponseMessagesDto> AddApplicant(ApplicantDto dto)
        {
            try
            {
                var customer = await _applicantRepository.Insert(new Applicant()
                {
                    Name            = dto.Name,
                    FamilyName      = dto.FamilyName,
                    Address         = dto.Address,
                    CountryOfOrigin = dto.CountryOfOrigin,
                    EmailAddress    = dto.EmailAddress,
                    Age             = dto.Age,
                    Hired           = dto.Hired,
                });

                return(new ResponseMessagesDto()
                {
                    Id = customer.Id,
                    SuccessMessage = "Success",
                    Success = true,
                    Error = false
                });
            }

            catch (Exception e)
            {
                Console.WriteLine(e);
                return(new ResponseMessagesDto()
                {
                    Id = 0,
                    FailureMessage = "Failed Insertion",
                    Success = false,
                    Error = true,
                    ExceptionMessage = e.InnerException != null ? e.InnerException.Message : e.Message
                });
            }
        }