58 lines
2.2 KiB
C#
58 lines
2.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Collections.ObjectModel;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using Avalonia.Media.Imaging;
|
|
using CommunityToolkit.Mvvm.ComponentModel;
|
|
using LiveChartsCore.Defaults;
|
|
|
|
namespace CryptoPortfolio_Tracker.Models;
|
|
|
|
public partial class Cryptocurrency : ObservableObject
|
|
{
|
|
public long Id { get; set; }
|
|
|
|
[ObservableProperty] public partial string Symbol { get; set; } = null!;
|
|
|
|
[ObservableProperty] public partial string Name { get; set; } = null!;
|
|
|
|
[ObservableProperty] public partial int CryptoTypeId { get; set; }
|
|
|
|
[ObservableProperty] public partial long NetworkId { get; set; }
|
|
|
|
[ObservableProperty] public partial string CoingeckoId { get; set; } = null!;
|
|
|
|
[ObservableProperty] public partial CryptoType CryptoType { get; set; } = null!;
|
|
|
|
[ObservableProperty] public partial Network Network { get; set; } = null!;
|
|
|
|
[ObservableProperty] public partial ICollection<Transaction> Transactions { get; set; } = new List<Transaction>();
|
|
|
|
[ObservableProperty] public partial ICollection<UserWallet> UserWallets { get; set; } = new List<UserWallet>();
|
|
|
|
[NotMapped] [ObservableProperty] public partial decimal? PriceChange24H { get; set; }
|
|
|
|
[NotMapped]
|
|
[ObservableProperty]
|
|
[NotifyPropertyChangedFor(nameof(IsPositive))]
|
|
[NotifyPropertyChangedFor(nameof(IsNegative))]
|
|
public partial decimal? PriceChangePercentage24H { get; set; }
|
|
|
|
[NotMapped] [ObservableProperty] public partial decimal CurrentPriceUsd { get; set; }
|
|
|
|
[NotMapped] [ObservableProperty] public partial DateTime? PriceUpdatedAt { get; set; }
|
|
|
|
[NotMapped] [ObservableProperty] public partial decimal? MarketCapUsd { get; set; }
|
|
|
|
[NotMapped] [ObservableProperty] public partial decimal? Volume24HUsd { get; set; }
|
|
|
|
[NotMapped] [ObservableProperty] public partial Bitmap? Image { get; set; }
|
|
|
|
[NotMapped] public bool IsPositive => PriceChangePercentage24H > 0;
|
|
|
|
[NotMapped] public bool IsNegative => PriceChangePercentage24H < 0;
|
|
|
|
[NotMapped] public ObservableCollection<DateTimePoint> PriceHistory24H { get; set; } = [];
|
|
|
|
[NotMapped] public ObservableCollection<DateTimePoint> PriceHistory7D { get; set; } = [];
|
|
} |