Commit d808cb17 authored by Mahmoud Bakhtvar's avatar Mahmoud Bakhtvar

using is ommited

parent 4381fa38
...@@ -30,12 +30,11 @@ namespace SendFileWebapi.Controllers ...@@ -30,12 +30,11 @@ namespace SendFileWebapi.Controllers
inputsDto.FileNames.ToObservable() inputsDto.FileNames.ToObservable()
.Select(fileName => Observable.FromAsync(async () => .Select(fileName => Observable.FromAsync(async () =>
{ {
using (var stream = fileName.OpenReadStream()) var stream = fileName.OpenReadStream();
{
var request = new Dicom.Network.DicomCStoreRequest(await DicomFile.OpenAsync(stream)); var request = new Dicom.Network.DicomCStoreRequest(await DicomFile.OpenAsync(stream));
await client.AddRequestAsync(request); await client.AddRequestAsync(request);
await client.SendAsync(); await client.SendAsync();
} stream.Dispose();
}).Select(x => fileName.FileName).Catch<string, Exception>(exp => throw new Exception($"failed to send: {fileName}, with error:{exp.Message}"))) }).Select(x => fileName.FileName).Catch<string, Exception>(exp => throw new Exception($"failed to send: {fileName}, with error:{exp.Message}")))
.Concat() .Concat()
.Subscribe( .Subscribe(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment