39 lines
1.1 KiB
C#
39 lines
1.1 KiB
C#
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)
|
|
};
|
|
}
|
|
} |