2
I have the following code:
public async Task<IHttpActionResult> Gravar()
{
List<Tuple<string, string>> statusRetorno = new List<Tuple<string, string>>();
statusRetorno.Add(new Tuple<string, string>("1245", "OK"));
statusRetorno.Add(new Tuple<string, string>("1468", "ERROR"));
statusRetorno.Add(new Tuple<string, string>("7548", "OK"));
return Ok(statusRetorno);
}
I have to change the code above:
If all Tuple are "OK" return
Return Ok(statusReturn)
If you have an "ERROR" I have to return
Internalservererror(new Exception(status)
I have the following error, if you try to return 'Internalservererror'
Cannot Convert from 'System.Collections.Generic.List(System.Tuple' to 'string'
What would be the best way to return this information?
You will have to create a custom Exception because the default Exception does not take the List<Tuple<string, string>> parameter in the constructor as LINQ already mentioned
– Victor Laio