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; }
|
|
|
|
|
|
|
|
public List<CountryCreate> CountriesToCreate { get; set; }
|
|
|
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
|