public async Task <IEnumerable <TaskViewModel> > GetAll() { var taskEntities = await _taskManagerRepository.GetAll(); var tasks = new List <TaskViewModel>(); foreach (var taskEntity in taskEntities) { var taskViewModel = _mapper.Map <TaskViewModel>(taskEntity); tasks.Add(taskViewModel); } return(tasks); }
public async Task <IEnumerable <TaskViewModel> > GetAllTasks() { var taskEntities = await _taskManagerRepository.GetAll(); var tasks = new List <TaskViewModel>(); foreach (var taskEntity in taskEntities) { tasks.Add(new TaskViewModel() { Id = taskEntity.Id, TaskName = taskEntity.TaskName, ParentId = taskEntity.ParentId, ParentTaskName = GetParentTaskName(taskEntity.ParentId, taskEntities) ?? string.Empty, Priority = taskEntity.Priority, StartDate = taskEntity.StartDate, EndDate = taskEntity.EndDate }); } return(await Task.FromResult(tasks)); }