I have a method which return a class cono in Json format
[DataContract]
public class Cono
{
[DataMember(Order = 1)]
public Companies[] companies;
}
public class Companies
{
[DataMember(Order = 1)]
public string cono;
[DataMember(Order = 2)]
public string name;
}
[WebGet(UriTemplate = "GetCompanies?requestKey={requestKey}",
ResponseFormat = WebMessageFormat.Json)]
public Cono GetCompanies(string requestKey);
this method first validate request key if it is correct it returns data like this:
{
companies: [
{
cono: "001",
name: "Company001"
}
]
}
but if request key is not correct I want to return an error code in json like this
{-100}
How can I change the return type of the method to Int or how can I return desired data in the above format