fetching selected ids from checkbox and retriving the data as needed
but obly the last record gets displayed
var checkedData = model.Where(m => m.IsChecked == true).ToList();
var selectIds = checkedData.Select(m => m.OrderId).ToArray();
if (selectIds != null)
{
foreach (var id in selectIds)
{
model = db.Orders.Where(u => u.OrderId == id).Select(u => new SelectedOrderViewModel
{
ProductName= u.ProductName= ,
Qty= u.Qty ,
Address= u.Address,
}).ToList();
}
}
i get the records to be displayed .but i get only one record tats the last record . though i have 4 selected id . it loops 4 times but in the model only last record is stored