Add project files.
This commit is contained in:
1 parent
fd9f318d6a
commit
0ce077ec11
98 files changed
+65707
No files matched your search
@@ -0,0 +1,39 @@
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace BudgetApp.Data;
|
||||
|
||||
public class Account
|
||||
{
|
||||
public int Id { get; set; }
|
||||
|
||||
[Required, MaxLength(100)]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
|
||||
public decimal CurrentBalance { get; set; }
|
||||
|
||||
[Required, MaxLength(7)]
|
||||
public string Color { get; set; } = "#1b6ec2";
|
||||
|
||||
[Required, MaxLength(3)]
|
||||
public string CurrencyCode { get; set; } = "GBP";
|
||||
|
||||
[Required]
|
||||
public string UserId { get; set; } = string.Empty;
|
||||
|
||||
public ApplicationUser User { get; set; } = default!;
|
||||
|
||||
public List<Transaction> Transactions { get; set; } = [];
|
||||
|
||||
public static readonly Dictionary<string, string> CurrencySymbols = new()
|
||||
{
|
||||
["USD"] = "$", ["EUR"] = "€", ["GBP"] = "£", ["JPY"] = "¥",
|
||||
["CAD"] = "C$", ["AUD"] = "A$", ["CHF"] = "CHF", ["CNY"] = "¥",
|
||||
["INR"] = "₹", ["BRL"] = "R$", ["KRW"] = "₩", ["MXN"] = "MX$",
|
||||
["SEK"] = "kr", ["NOK"] = "kr", ["DKK"] = "kr", ["NZD"] = "NZ$",
|
||||
["ZAR"] = "R", ["PLN"] = "zł", ["TRY"] = "₺", ["THB"] = "฿"
|
||||
};
|
||||
|
||||
public string GetSymbol() => CurrencySymbols.GetValueOrDefault(CurrencyCode, CurrencyCode);
|
||||
|
||||
public string FormatAmount(decimal amount) => $"{GetSymbol()}{amount:N2}";
|
||||
}
|
||||
Reference in new issue
Block a user