Код: Выделить всё
public class PayParam
{
public LineItemParam[] LineItems { get; set; }
public string Phone { get; set; }
public string Email { get; set; }
public string CustomerId { get; set; }
public string CompanyName { get; set; }
}
public class LineItemParam
{
public string Sku { get; set; }
public string Description { get; set; }
public decimal UnitPrice { get; set; }
public int Quantity { get; set; }
}
Код: Выделить всё
var parameters = new PayParam();
MailingInfo IdData = scData.FindData();
string[] desc = {"Test1", "Test2", "Test3};
parameters = new PayParam
{
Phone = IdData.PhoneNumber,
Email = IdData.Email.ToUpper(),
CustomerId = "1234",
CompanyName = "TEST NAME",
},
LineItems = new LineItemParam[]
{
new LineItemParam
{
Sku = GetSKU(),
Description = "Test Desc",
UnitPrice = 12.00,
Quantity = 1
}
}
Код: Выделить всё
parameters = new PayParam
{
Phone = IdData.PhoneNumber,
Email = IdData.Email.ToUpper(),
CustomerId = "1234",
CompanyName = "TEST NAME",
},
foreach(var de in desc)
{
LineItems = new LineItemParam[]
{
new LineItemParam
{
Sku = GetSKU(),
Description = de,
UnitPrice = 12.00,
Quantity = 1
}
}
}
Код: Выделить всё
parameters = new PayParam
{
Phone = IdData.PhoneNumber,
Email = IdData.Email.ToUpper(),
CustomerId = "1234",
CompanyName = "TEST NAME",
},
LineItems = new LineItemParam[]
{
new LineItemParam
{
Sku = GetSKU(),
Description = "Test1",
UnitPrice = 12.00,
Quantity = 1
},
new LineItemParam
{
Sku = GetSKU(),
Description = "Test2",
UnitPrice = 12.00,
Quantity = 1
},
}
Буду признателен за любую помощь.
Подробнее здесь: https://stackoverflow.com/questions/790 ... -in-a-loop