// GET: api/TaskManager/5 public IEnumerable <ParentTask> GetAllParentTasks() { ProjectManagerBL taskManagerBL = new ProjectManagerBL(); List <ParentTask> lstTask = new List <ParentTask>(); foreach (var task in taskManagerBL.ReadAllParentTask()) { lstTask.Add(new ParentTask() { ParentId = task.Parent_ID, ParentTaskName = task.Parent_Task }); } return(lstTask); }