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)
|
|
|
|
{
|
2022-08-19 06:18:50 +03:00
|
|
|
var newCountry = new Country(countryCreate, null, null);
|
2022-08-18 22:59:13 +03:00
|
|
|
countries.Add(newCountry);
|
|
|
|
}
|
|
|
|
|
|
|
|
return new Currency(this, countries);
|
|
|
|
|
|
|
|
}
|
2022-08-17 23:21:00 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|