Hi so here's what i have so far... In my controller:
public ActionResult SingleFeed (string linename)
{
var result = (from x in db.is1
where x.in_service == "Y"
join y in db.isckts on
x.is_id equals y.is_id
where y.line_name == linename
group new {x, y} by x.is_id into xyg
where xyg.Count() == 1
select xyg);
var SFM = new CircuitsViewModel()
{
IsDetails = result.ToList()
};
return View(SFM);
}
In my view:
public class CircuitsViewModel
{
public List<is1> IsDetails { get; set; }
public List<isckt> IscktDetails { get; set; }
}
I end up with a
cannot implicitly convert type 'System.Collections.Generic.List(System.Linq.IGrouping(short, (anonymous type: is1 x, isckt y)))' to 'System.Collections.Generic.List(is1)
Was wondering if anyone could help with this error. Started happening when i tried to using LINQ grouping but i have no idea how to model the Viewmodel or chage the LINQ query to match the type.
The idea behind the LINQ query is to return records that does not have duplicate entries in the id column on table isckts.
UPDATE: Currently trying to figure out how to find duplicates in db.isckts.is_ID then do a join on IS_ID then do a where to specify the line_name and in_service
Any help would be appreciated! cheers!