// GET: api/TaskManager/5 public IEnumerable <ParentTask> GetAllParentTasks() { TaskManagerBL taskManagerBL = new TaskManagerBL(); 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); }