I use this:
public class ConstructionRepository
{
private CRDataContext db = new CRDataContext();
public IQueryable<Material> FindAllMaterials()
{
//return db.Materials;
var materials = from m in db.Materials
join Mt in db.MeasurementTypes on m.MeasurementTypeId equals Mt.Id
select new Material
{
Mat_Name = m.Mat_Name,
MeasurementTypeId = Mt.Name,
Mat_Type = m.Mat_Type };
return materials.AsQueryable();
}
}
It gives me the only error
- 'CrMVC.Models.Material' does not contain a definition for 'MatId','MesName','MesType'
EDIT: 'MatId','MesName','MesType' are just fake names i gave is that wrong..