I have this piece of code as an Azure function app and I would like to know how can I best handle this if else part.
There are like 100 Project with different customer name.
What is the best way to do it?
If one can show me with an example.
string customerName = string.Empty;
foreach( var doc in result )
{
var data =(JObject)JsonConvert.DeserializeObject( doc.ToString() );
if( (string)data["Project"] == "HPD_Oid" )
{
customerName = "OPPO";
}
else if( (string)data["Project"] == "HPD_Oreal" )
{
customerName = "RealMe";
}
else
{
customerName = "OnePlus";
}
string partitionkeyValue = string.Concat( (string)data["class"], "|", (string)data["Project"], "|", customerName );
data.Add( new JProperty( "PartitionKey", partitionkeyValue ) );
Aucun commentaire:
Enregistrer un commentaire