I´m tryin to make a query to receive all data in my database to show it in my view.
but it´s not working. i can´t figured it out what is going on because i don´t get any error.
anybody can help with this pls?
thanks in advance
Controller:
public ActionResult Details(int id = 0)
{
Persons p= db.persons.Find(id);
var query = from a in db.images
where a.Id_Person== id
select a.FileName;
ViewBag.ImgRev= query;
if (mag == null)
{
return HttpNotFound();
}
return View(p);
}
View:
@foreach (var p in ViewBag.ImgRev)
{
<div>
<img src="~/Files/" + @p /></div>
}