CodeLiturgy.Dashboard/BlueWest.Data/Country/Country.cs

39 lines
919 B
C#
Raw Normal View History

2022-08-17 23:21:00 +03:00
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
2022-08-18 22:59:13 +03:00
using System.Text.Json.Serialization;
2022-08-17 23:21:00 +03:00
using MapTo;
2022-08-13 05:59:37 +03:00
2022-08-17 23:21:00 +03:00
namespace BlueWest.Data
2022-08-13 05:59:37 +03:00
{
2022-08-19 02:02:57 +03:00
[MapFrom(new []
{
typeof(CountryUpdate),
typeof(CountryCreate),
typeof(CountryUnique)
})]
2022-08-17 23:21:00 +03:00
public partial class Country
2022-08-13 20:15:43 +03:00
{
2022-08-17 23:21:00 +03:00
// ISO 3166-1 numeric code
public int Code { get; set; } // Primary key
public string StateName { get; set; }
2022-08-13 20:15:43 +03:00
2022-08-17 23:21:00 +03:00
[MaxLength(2)] public string Alpha2Code { get; set; }
public string TLD { get; set; }
public List<Currency> Currencies { get; set; }
2022-08-18 22:59:13 +03:00
[JsonConstructor]
2022-08-17 23:21:00 +03:00
public Country(int code, string stateName, string tld, List<Currency> currencies)
{
Code = code;
StateName = stateName;
TLD = tld;
Currencies = currencies;
}
2022-08-18 22:59:13 +03:00
public Country() { }
2022-08-17 23:21:00 +03:00
}
}