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); }));
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)); } }
private void LoadPropertyValues(PricingDto result) { txtName.Text = result.Name; txtPrice.Text = result.Price.ToString(); }