private FileAccessTreeViewModel MapAccessTreeToViewModel(FileAccessTreeDto dto) { if (dto == null) { return(null); } var viewModel = new FileAccessTreeViewModel { AccessTreeId = dto.AccessTreeId, File = MapFileToViewModel(dto.File), Gate = MapGateToViewModel(dto.Gate), FileAttribute = MapAttributeToViewModel(dto.FileAttribute), Children = new List <FileAccessTreeViewModel>() }; foreach (var child in dto.Children) { viewModel.Children.Add(MapAccessTreeToViewModel(child)); } return(viewModel); }
public static FileAccessTreeDto MapToDto(FileAccessTree fileAccessTree) { if (fileAccessTree == null) { return(null); } var fileAccessTreeDto = new FileAccessTreeDto { AccessTreeId = fileAccessTree.AccessTreeId, Gate = GateMapper.MapToDto(fileAccessTree.Gate), File = FileMapper.MapToDto(fileAccessTree.File), FileAttribute = FileAttributeMapper.MapToDto(fileAccessTree.FileAttribute), Children = new List <FileAccessTreeDto>() }; foreach (var child in fileAccessTree.Children) { fileAccessTreeDto.Children.Add(MapToDto(child)); } return(fileAccessTreeDto); }
public void SetUp() { _accessTree = new FileManager().GetAccessTreeByFileId(1); }