static T Post <T>(BikeRegResource resource, object body) { var request = new RestRequest(resource.ToString(), Method.POST).AddJsonBody(body); var content = new RestClient(BaseURL).Execute(request).Content; var serializedValue = JsonConvert.DeserializeObject <JObject>(content).Property(resource.Header()).Value.ToString(); return(JsonConvert.DeserializeObject <T>(serializedValue)); }
static string Header(this BikeRegResource resource) => resource == BikeRegResource.PromoterLogin ? "PromoterLoginResult" : "Get" + resource.ToString() + "Result";