Reputation: 3295
I am calling stored procedure to get data from database using Linq. This stored procedure is using more than one table to return result using join :
public static List<classname> GetMediaTemp()
{
var medialist = (from m in Context.sp_Temp() select new classname
{
str_image = m.str_image,
str_image_type = m.str_image_type,
str_photodrawvideo = m.str_photodrawvideo,
}).ToList();
if (medialist.Count > 0)
{
return medialist
}
}
Everything working fine but now i have to filter data in this object list like on the calling end
List<classname> photoList = GetMediaTemp();//Here i want to filter list on the basis on str_photodrawvideo column.
Problem :
How i can perform this filter ?
Thanks in Advance. For more info please let me know.
Upvotes: 2
Views: 9494
Reputation: 63065
you can do as below
var objList = Context.sp_Temp().ToList();
var photoList = objList.Where(o=>o._int_previous == 1).ToList();
Or
you can cast the object
to Class which build the object list as below
var photoList =
(from pht in objList
let x=>(sp_TempResult)pht
where x._int_previous == 1 select pht).ToList();
Upvotes: 3