public IEnumerable <TaskDto> GetAllTask(Expression <Func <Task, bool> > exp = null) { var tasks = _taskDal.GetAllByExp(exp).ToList(); var taskDtoList = new List <TaskDto>(); tasks.ForEach(t => { taskDtoList.Add(new TaskDto { Id = t.Id, Name = t.Name, Description = t.Description, BeginDate = t.BeginDate, EndDate = t.EndDate }); }); return(taskDtoList); }