public async Task <Response <GetChartViewModel> > Handle(GetChartQuery request, CancellationToken cancellationToken) { GetChartViewModel result = new GetChartViewModel(); var allPerson = await _repository.GetAllAsync(); var root = allPerson.FirstOrDefault(_ => _.IdParent == 0); if (root != null) { result.Id = root.Id; result.Name = root.Name; result.Description = ""; result.Children = findChild(root); } return(new Response <GetChartViewModel>(result)); }
public Task <List <Person> > GetAllAsync() { return(personRepository.GetAllAsync()); }