finish off handbook helper

This commit is contained in:
CWX
2025-01-19 22:50:50 +00:00
parent 608e4c4a31
commit 10b4edfd8a
+8 -2
View File
@@ -169,12 +169,18 @@ public class HandbookHelper(
/// <returns>currency count in desired type</returns>
public double FromRUB(double roubleCurrencyCount, string currencyTypeTo)
{
throw new NotImplementedException();
if (currencyTypeTo == Money.ROUBLES) {
return roubleCurrencyCount;
}
// Get price of currency from handbook
var price = GetTemplatePrice(currencyTypeTo);
return price is not null ? Math.Max(1, Math.Round((double)(roubleCurrencyCount / price))) : 0;
}
public HandbookCategory GetCategoryById(string handbookId)
{
throw new NotImplementedException();
return _databaseService.GetHandbook().Categories.FirstOrDefault(category => category.Id == handbookId);
}
}