using Microsoft.AspNetCore.Components; using Normalize.ClientHub.Models; namespace Normalize.ClientHub.Pages; public partial class Calculator { private int _VIN = 0; private decimal _Value = 0; private int _Miles = 107228; private decimal _BasePrice = 12816; private decimal _OutTheDoor = 15801.34m; [Inject] protected AppSettings? AppSettings { get; set; } [Inject] protected ILogger? Logger { get; set; } protected override void OnParametersSet() => Calculate(); private void Calculate() { if (Logger is null) throw new NullReferenceException(nameof(Logger)); if (AppSettings is null) throw new NullReferenceException(nameof(AppSettings)); _Value = _OutTheDoor / (AppSettings.ExpectedMileage - _Miles); } }