public ActionResult Index()
{
var pr = db.products;
return View(pr);
}
Firstly - I want to pass to the view more data - something like:
public ActionResult Index()
{
var pr = db.products;
var lr = db.linksforproducts(2)
return View(pr,lr);
}
How do I read the lr
data in the view?
Secondly - on the view I have a table of products, and I want to add to the table a column with all the tags of this products. How do I get the tags for every product?
now i create this code
public class catnewModel
{
public IQueryable<category> dl { get; set; }
public IQueryable<product> dr { get; set; }
}
and my controller
public ActionResult Index()
{
var pr = db.products;
var pl = db.categories;
catnewModel model = new catnewModel();
model.dr = pr;
model.dl = pl;
return View(model);
}
in my view i try to iterate over
<% foreach (var item in Model.dr) %>
but i get error on
error CS1061: 'System.Collections.Generic.IEnumerable<amief.Models.catnewModel>' does not contain a definition for 'dr' and no extension method