Код: Выделить всё
public class MyModel {
public ProgramModel(Guid id, string name, string description, Currency currency) {
Id = id;
Name = name;
Description = description;
Currency = currency;
}
public Guid Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public Currency Currency { get; set; }
}
Код: Выделить всё
public class Currency {
public Currency(string numericCode, string code, string name) {
NumericCode = numericCode;
Code = code;
Name = name;
}
public string NumericCode { get; set; }
public string Code { get; set; }
public string Name { get; set; }
}
Usage example
var currency = new Currency("978", "EUR", "Euro");
Код: Выделить всё
[BindProperty]
public MyModel MyModel { get; set; }
[BindProperty]
public IEnumerable AllCurrencies { get; set; }
Код: Выделить всё
@foreach (var currency in Model.AllCurrencies) {
if (currency.Code == Model.MyModel.Currency.Code) {
@currency.Name
}
else {
@currency.Name
}
}
Подробнее здесь: https://stackoverflow.com/questions/790 ... ct-element
Мобильная версия