コード例 #1
0
ファイル: Extensions.cs プロジェクト: rklepacz/Cine
 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);
 }));
コード例 #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));
            }
        }
コード例 #3
0
 private void LoadPropertyValues(PricingDto result)
 {
     txtName.Text  = result.Name;
     txtPrice.Text = result.Price.ToString();
 }