i want to print the viewbag recieved from the controller but i cant, my code in the controller is here:
var qry = from c in db.Customers
join o in db.Orders on id equals o.CustomerID
where id == o.CustomerID
select new {o.OrderID ,o.OrderDetails};
ViewBag.OrdersForUser = qry.ToList();
the printing code in my view is :
@foreach (var order in ViewBag.OrdersForUser)
{
@order
}
the printed text right now is:
{ OrderID = 1, OrderDetails = System.Collections.Generic.HashSet`1[FinalProject.Models.OrderDetail] }
the type of OrderID is int, the type of OrderDeatils is ICollection i want to print the data in the hash set (and not the decleration like now) , and to split the Order Id into other space.