public async Task <DownloadResponse> FetchDownload(string id) { var downloadResponse = new DownloadResponse(); var audioEntity = await _tableDbContext.GetEntityAsync("Uploads", id); // use try/parse instead? if (audioEntity.ProcessStatusEnum == ProcessStatusEnum.Failed.EnumValue()) { downloadResponse.GeneralStatusEnum = GeneralStatusEnum.Fail; return(downloadResponse); } //signalr to update status. var assemblyResponse = await GetTranscription(id); if (assemblyResponse.Status == "completed") { _ = await _dataRepository.UpdateTable(id, ProcessStatusEnum.Completed, null); downloadResponse.GeneralStatusEnum = GeneralStatusEnum.Ok; downloadResponse.AudioEntity = await _tableDbContext.GetEntityAsync("Uploads", id); downloadResponse.TranscriptionResponse = assemblyResponse; return(downloadResponse); } return(downloadResponse); }
public async Task <DownloadResponse> FetchDownload(string id) { var downloadResponse = new DownloadResponse(); var imageEntity = await _tableDbContext.GetEntityAsync("Uploads", id); // use try/parse instead? if (imageEntity.ProcessStatusEnum != ProcessStatusEnum.Completed.EnumValue()) { downloadResponse.GeneralStatusEnum = GeneralStatusEnum.Processing; downloadResponse.ImageEntity = null; } else { downloadResponse.GeneralStatusEnum = GeneralStatusEnum.Ok; downloadResponse.ImageEntity = imageEntity; } return(downloadResponse); }
public async Task <bool> CheckTableRecordAvailable(string id) { var record = await _tableDbContext.GetEntityAsync("Uploads", id); return(record == null ? false : true); }