public void Run()
        {
            Console.WriteLine("Starting up...");

            var mexicoInsuranceApplicant = new MexicoInsuranceApplicant(new DateTime(1973, 1, 13), 46000);

            Console.WriteLine("Calculating premium for Mexico applicants...");

            mexicoInsuranceApplicant.CalculatePremium();

            Console.WriteLine("Premium is {0}", mexicoInsuranceApplicant.Premium);

            Console.WriteLine("Saving to store...");
            _repository.Save(mexicoInsuranceApplicant);

            Console.WriteLine("Calculating premium for Canada applicants...");
            var canadaInsuranceApplicant = new CanadaInsuranceApplicant(new DateTime(1973, 1, 13), 46000);

            canadaInsuranceApplicant.CalculatePremium();
            Console.WriteLine("Premium is {0}", canadaInsuranceApplicant.Premium);

            Console.WriteLine("Saving to store...");
            _repository.Save(canadaInsuranceApplicant);
            Console.WriteLine("Done.");

            Console.Read();
        }
        public Response CreateApplicant(ApplicantModel applicant)
        {
            _logger.LogInformation("Request Made to CreateApplicant: ", applicant.ToString());
            Response response = _utilities.InitializeResponse();

            try
            {
                _applicantRepository.InsertApplicant(applicant);
                _applicantRepository.Save();
            }
            catch (Exception ex)
            {
                return(_utilities.CatchException(ex, response));
            }

            var applicantUrl = _configuration.GetSection("AppBaseUrl").Value;

            response.Data = applicantUrl + applicant.ID;

            _logger.LogInformation($"Successfully created applicant {applicant.ID}");
            return(response);
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            _applicantRepository = new FileApplicantRepository();

            try
            {
            }
            finally
            {
                _applicantRepository.Save();
            }
            Console.WriteLine("Hello World!");
        }
        public async Task <ApplicantDetail> Save(ApplicantDto detail)
        {
            var applicantDetail = new ApplicantDetail {
                Id          = detail.Id,
                FirstName   = detail.FirstName,
                LastName    = detail.LastName,
                Email       = detail.Email,
                DateOfBirth = detail.DateOfBirth,
                StateId     = detail.State,
                Disabled    = detail.Disabled,
                Address     = detail.Address,
                City        = detail.City,
                PostalCode  = detail.PostalCode,
                Mobile      = detail.Mobile,
                Phone       = detail.Phone
            };

            return(await _applicant.Save(applicantDetail));
        }