public int CalculateLease(int id) { ILeasable property = _leasableRepository.GetLeasable(id); Type type = property.GetType(); if (_calculations.TryGetValue(type, out var calculation)) { return(calculation(property)); } throw new Exception("Unexpected type, please extend the calculator"); }
public void ShowLeasingCharges(int id) { leasable = leasableRepository.GetLeasable(id); var leasingCharge = GetLeasingCharges((T)leasable); }