define a collection data contract
[CollectionDataContract]
public class DC_LIST_DEPARTMENTS_LIST : List<DC_LIST_DEPARTMENTS> {
...
}
and use this collection data contract as return type of operation method.
public DC_LIST_DEPARTMENTS_LIST GetAllDepartments() {
...
}
and here is the modified implementation for service method:
public DC_LIST_DEPARTMENTS_LIST GetAllDepartments() {
IList<DC_LIST_DEPARTMENTS> DCListOfDepartments = new List<DC_LIST_DEPARTMENTS>();
ICollection<BDO_LIST_DEPARTMENTS> BDOListOfDepartments = Bal.GetAllDepartments();
foreach (BDO_LIST_DEPARTMENTS BDODepartment in BDOListOfDepartments) {
DC_LIST_DEPARTMENTS DCDepartment = new DC_LIST_DEPARTMENTS() {
DEPARTMENT_ID = BDODepartment.DEPARTMENT_ID,
DEPARTMENT_NAME = BDODepartment.DEPARTMENT_NAME
};
DCListOfDepartments.Add(DCDepartment);
}
return DCListOfDepartments;
}