Init
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
using FinlyticCore.Models.Assets;
|
||||
|
||||
namespace FinlyticAssets.Models;
|
||||
|
||||
public class AssetsCount
|
||||
{
|
||||
public int Stock { get; set; }
|
||||
public int Funds { get; set; }
|
||||
public int Derivatives { get; set; }
|
||||
public int Crypto { get; set; }
|
||||
public int Bond { get; set; }
|
||||
|
||||
public int GetCountFromType(AssetType type)
|
||||
{
|
||||
return type switch
|
||||
{
|
||||
AssetType.Stock => Stock,
|
||||
AssetType.Fund => Funds,
|
||||
AssetType.Derivative => Derivatives,
|
||||
AssetType.Crypto => Crypto,
|
||||
AssetType.Bond => Bond,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
public void SetCountOfType(AssetType type, int count)
|
||||
{
|
||||
_ = type switch
|
||||
{
|
||||
AssetType.Stock => Stock = count,
|
||||
AssetType.Fund => Funds = count,
|
||||
AssetType.Derivative => Derivatives = count,
|
||||
AssetType.Crypto => Crypto = count,
|
||||
AssetType.Bond => Bond = count,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(type), type, null)
|
||||
};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user