public class SearchService public ClothCategory GetCategory int id usi

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
public class SearchService
{
public ClothCategory GetCategory(int id)
{
using (ClothRetailEntities clothRetailDataContext = new ClothRetailEntities())
{
SearchService catalogService = new SearchService();
return (from clothCategory in clothRetailDataContext.ClothCategory
where clothCategory.Id == id
select clothCategory).FirstOrDefault();
}
}
public ClothCategory[] GetRootCategories()
{
using (ClothRetailEntities clothRetailDataContext = new ClothRetailEntities())
{
SearchService catalogService = new SearchService();
return (from clothCategory in clothRetailDataContext.ClothCategory
where clothCategory.Parent == null
select clothCategory).ToArray();
}
}
}