if (ftpType == "YouTube")
{
var digitalServiceResponse = JsonConvert.DeserializeObject<YoutubeMetadataResponse>(metadataJson);
var fileRequest = new AddDeliveryFileRequest
{
//some code
};
ftpDeliveryQueue.AddFile(fileRequest);
}
else if (ftpType == "Flashtalking")
{
var metadata = JsonConvert.DeserializeObject<FlashtalkingMetadataResponse>(metadataJson);
foreach (var file in metadata.FileList)
{
var fileRequest = new AddDeliveryFileRequest
{
//some code
};
ftpDeliveryQueue.AddFile(fileRequest);
}
}
else if (ftpType == "Innovid")
{
var metadata = JsonConvert.DeserializeObject<InnovidMetadataResponse>(metadataJson);
foreach (var file in metadata.FileList)
{
var fileRequest = new AddDeliveryFileRequest
{
//some code
};
ftpDeliveryQueue.AddFile(fileRequest);
}
}
else
{
var digitalServiceResponse = JsonConvert.DeserializeObject<SizmekMetadataResponse>(metadataJson);
foreach (var file in digitalServiceResponse.Metadata.FileList)
{
var fileRequest = new AddDeliveryFileRequest
{
//some code
};
ftpDeliveryQueue.AddFile(fileRequest);
}
}
How do I get rid of these if and else if block with the help of factory method?
Aucun commentaire:
Enregistrer un commentaire