Ejemplo n.º 1
0
 public static IApplicationBuilder UsePricingApi(this IApplicationBuilder app)
 => app.UseEndpoints(endpoints => endpoints
                     .Get <GetCinemaPricing, PricingDto>("pricing/{cinemaId}", async(query, ctx) =>
 {
     var dto = new PricingDto {
         CinemaId = query.CinemaId
     };
     await ctx.Response.WriteJsonAsync(dto);
 }));
Ejemplo n.º 2
0
        public async Task <decimal> CalculateMonthlyPremiumAsync(PricingDto pricingDto)
        {
            //the whole occupation list could be cached for better performances
            var occupation = await _occupationRepository.GetByIdAsync(pricingDto.OccupationId);

            if (occupation == null)
            {
                throw new OccupationNotFoundException(new Exception($"Occupation {pricingDto.OccupationId} not found"));
            }
            else
            {
                var ratingFactor = RatingFactor(occupation.RatingType);
                return(CalculateMonthlyPremium(pricingDto.CoverAmount, pricingDto.Age, ratingFactor));
            }
        }
Ejemplo n.º 3
0
 private void LoadPropertyValues(PricingDto result)
 {
     txtName.Text  = result.Name;
     txtPrice.Text = result.Price.ToString();
 }