public Widget Find(string id) { var directroyData = _directoryQuery.Find(id); Widget widget = new Widget(directroyData.Id, directroyData.Name); widget.Data = new List<WidgetData>(); _fileQuery = new FileQuery(base.ContextString + @"/" + widget.Name); var fileDataList = _fileQuery.GetAll(); foreach (var fileData in fileDataList) { WidgetData widgetData = new WidgetData(fileData.Id, fileData.Name, fileData.Data); widget.Data.Add(widgetData); } return widget; }
public IEnumerable<Widget> GetAll() { var directoryList = _directoryQuery.GetAll(); List<Widget> widgets = new List<Widget>(); foreach (var directoryData in directoryList) { Widget widget = new Widget(directoryData.Id, directoryData.Name); widget.Data = new List<WidgetData>(); _fileQuery = new FileQuery(base.ContextString + "\\" + directoryData.Name); List<FileData> fileData = _fileQuery.GetAll(); foreach(var file in fileData) { widget.Data.Add( new WidgetData(file.Id, file.Name, file.Data)); } widgets.Add(widget); } return widgets; }