CodeLiturgy.Dashboard/BlueWest.Data/Currency/CurrencyCreate.cs

31 lines
798 B
C#
Raw Normal View History

2022-08-18 22:59:13 +03:00
using System.Collections.Generic;
2022-08-17 23:21:00 +03:00
using System.ComponentModel.DataAnnotations;
using MapTo;
namespace BlueWest.Data
{
[MapFrom(typeof(Currency))]
public partial class CurrencyCreate
{
2022-08-18 22:59:13 +03:00
public int Num { get; set; } // Primary key
[MaxLength(3)] public string Code { get; set; }
2022-08-19 02:02:57 +03:00
public List<CountryUnique> CountriesToCreate { get; set; }
2022-08-18 22:59:13 +03:00
public CurrencyCreate() { }
public Currency ToCurrency()
{
List<Country> countries = new List<Country>();
foreach (var countryCreate in CountriesToCreate)
{
var newCountry = new Country(countryCreate, null);
countries.Add(newCountry);
}
return new Currency(this, countries);
}
2022-08-17 23:21:00 +03:00
}
}