2023-02-01 23:15:14 -07:00

29 lines
822 B
C#

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<Calculator>? 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);
}
}