Ejemplo n.º 1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddCors(c =>
            {
                c.AddPolicy("AllowOrigin", options => options.AllowAnyOrigin());
            });

            services.AddControllers();

            IInsuranceManagementService insuranceManagementService;
            IInsuranceDomain            InsuranceDomain = new InsuranceDomain();
            ISerializer Serializer = new Serializer();
            IInsuranceFormatInputOutput InsuranceFormatInputOutput = new InsuranceFormatInputOutput(InsuranceDomain, Serializer);
            IInsuranceRepository        InsuranceRepository        = new InsuranceRepository();

            IInsuranceServiceResponse InsuranceServiceResponse = new InsuranceServiceResponse(InsuranceRepository);

            insuranceManagementService = new InsuranceManagementService(
                InsuranceDomain,
                InsuranceFormatInputOutput,
                InsuranceServiceResponse,
                Serializer
                );

            services.AddSingleton <IInsuranceManagementService>(insuranceManagementService);
        }
Ejemplo n.º 2
0
 public async Task <ExternalResponse> UpdateInsurance(int insuranceId, object content)
 {
     DTO.Insurance insurance = Serializer.DeserializeObject <DTO.Insurance>(content.ToString());
     insurance = InsuranceDomain.UpdateInsuraceId(insuranceId, insurance);
     insurance = InsuranceDomain.AsignCoverage(insurance);
     return(await InsuranceServiceResponse.UpdateInsurance(insurance));
 }
Ejemplo n.º 3
0
        public void Init()
        {
            IInsuranceDomain            InsuranceDomain            = new InsuranceDomain();
            ISerializer                 Serializer                 = new Serializer();
            IInsuranceFormatInputOutput InsuranceFormatInputOutput = new InsuranceFormatInputOutput(InsuranceDomain, Serializer);

            IInsuranceServiceResponse InsuranceServiceResponse = MockInsuranceServiceResponse.Instance;

            insuranceManagementService = new InsuranceManagementService(
                InsuranceDomain,
                InsuranceFormatInputOutput,
                InsuranceServiceResponse,
                Serializer
                );

            insurance = new DTO.Insurance
            {
                insuranceId = 1,
                name        = "Incendios A1",
                description = "Seguro de Incendios",
                type        = 2,
                coverage    = "50%",
                start       = new DateTime(2000, 9, 11),
                period      = 12,
                price       = 200000,
                risk        = 4
            };

            customerInsurance = new DTO.CustomerInsurance
            {
                customerInsuranceId = 1,
                document            = "98632674",
                customerName        = "Mauricio Cadavid",
                insuranceId         = 1,
                name        = "Incendios A1",
                description = "Seguro de Incendios",
                type        = 2,
                coverage    = "50%",
                start       = new DateTime(2000, 9, 11),
                period      = 12,
                price       = 200000,
                risk        = 4
            };
        }
Ejemplo n.º 4
0
 public async Task <ExternalResponse> CreateCustomerInsurance(string document, object content)
 {
     DTO.CustomerInsurance customerInsurance = Serializer.DeserializeObject <DTO.CustomerInsurance>(content.ToString());
     customerInsurance = InsuranceDomain.UpdateValues(document, customerInsurance);
     return(await InsuranceServiceResponse.CreateCustomerInsurance(customerInsurance));
 }