using
System;
using
System.Collections.Generic;
using
System.Linq;
using
System.Web;
namespace
MVC3Test.Models
{
public
class
TestModels
{
public
static
List
<
TestSchool
>
GetAllSchools()
{
return
new
List
<
TestSchool
>
()
{
new
TestSchool{Id
=
1
,Name
=
"
ABC
"
},
new
TestSchool{Id
=
2
,Name
=
"
DEF
"
},
new
TestSchool{Id
=
3
,Name
=
"
HIJ
"
},
new
TestSchool{Id
=
4
,Name
=
"
LMN
"
}
};
}
public
static
List
<
TestSchoolDepartment
>
GetAllDepartment()
{
return
new
List
<
TestSchoolDepartment
>
()
{
new
TestSchoolDepartment{Id
=
1
,SchoolId
=
1
,Name
=
"
ABC_D1
"
},
new
TestSchoolDepartment{Id
=
2
,SchoolId
=
1
,Name
=
"
ABC_D2
"
},
new
TestSchoolDepartment{Id
=
3
,SchoolId
=
1
,Name
=
"
ABC_D3
"
},
new
TestSchoolDepartment{Id
=
4
,SchoolId
=
2
,Name
=
"
DEF_D1
"
},
new
TestSchoolDepartment{Id
=
5
,SchoolId
=
2
,Name
=
"
DEF_D2
"
},
new
TestSchoolDepartment{Id
=
6
,SchoolId
=
3
,Name
=
"
HIJ_D1
"
},
new
TestSchoolDepartment{Id
=
7
,SchoolId
=
3
,Name
=
"
HIJ_D2
"
},
new
TestSchoolDepartment{Id
=
8
,SchoolId
=
3
,Name
=
"
HIJ_D3
"
},
new
TestSchoolDepartment{Id
=
9
,SchoolId
=
3
,Name
=
"
HIJ_D4
"
},
new
TestSchoolDepartment{Id
=
10
,SchoolId
=
4
,Name
=
"
LMN_D1
"
}
};
}
public
static
List
<
TestSchoolDepartment
>
GetDepartmentBySchoolId(
int
schoolId)
{
List
<
TestSchoolDepartment
>
testSchoolDepartment
=
new
List
<
TestSchoolDepartment
>
();
foreach
(TestSchoolDepartment department
in
GetAllDepartment())
{
if
(department.SchoolId
==
schoolId)
{
testSchoolDepartment.Add(department);
}
}
return
testSchoolDepartment;
}
}
}