I am building my first ASP.Net MVC based app and have a problem accessing the results of a linq to sql query in one of my views.
Here is my controller:
public ActionResult Details(int id)
{
var dataContext = new BuffetSuppliersDBDataContext();
var supplier = from m in dataContext.BO_Suppliers
where m.SupplierID == id
select m;
return View(supplier);
}
How can I access the supplier.SupplierName property in my view page, I have seen examples using a foreach loop and casting ViewData.Model to IEnumerable but there is not much point in using a loop as i am only returning one row.