Hello, when the loop below runs, I need to add elements continuously.
I tried to do something like this but it didn't work. How can I solve this problem.
foreach (var item in products)
{
List<Urunler> list = new List<Urunler>();
list.Add(from p in models
select new
{
label = p.Name,
producturl = Url.RouteUrl("Product", new { SeName = p.SeName }),
productpictureurl = p.DefaultPictureModel.ImageUrl
};
result = models.Where(x => x.Id == item.Id).Select(p => new
{
label = p.Name,
producturl = Url.RouteUrl("Product", new { SeName = p.SeName }),
productpictureurl = p.DefaultPictureModel.ImageUrl
}).ToList();
}