public async Task OnGetAsync() { List <ServiceFresh.File> result = await client.GetFilesAsync(); foreach (var file in result) { Models.FileDTO dto = new Models.FileDTO(file); Files.Add(dto); } if (!string.IsNullOrEmpty(SearchString)) { Files.Clear(); List <ServiceFresh.Data> datas = await client.GetDatasAsync(); List <ServiceFresh.FileData> filedatas = await client.GetFileDatasAsync(); ServiceFresh.Data data = datas.Find(item => item.Label.Equals(SearchString)); if (data != null) { Files = new List <Models.FileDTO>(); foreach (ServiceFresh.File file in result) { ServiceFresh.FileData fd = filedatas.Find(item => item.DataId == data.DataId && item.FileId == file.FileId); if (fd != null) { Models.FileDTO dto = new Models.FileDTO(file); Files.Add(dto); } } } } }
public FileDataDTO(ServiceFresh.FileData rel) { this.FileDataId = rel.FileDataId; this.FileId = rel.FileId; this.DataId = rel.DataId; this.Value = rel.Value; this.CreatedAt = rel.CreatedAt; }