/// <summary> /// Create a new feature /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='body'> /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task <object> PostFeatureAsync(this IFeatureManagementAppTierAPI operations, Feature body = default(Feature), CancellationToken cancellationToken = default(CancellationToken)) { using (var _result = await operations.PostFeatureWithHttpMessagesAsync(body, null, cancellationToken).ConfigureAwait(false)) { return(_result.Body); } }
public async Task <IActionResult> Post(Feature feature) { if (feature == null) { return(BadRequest("Feature is required")); } if (string.IsNullOrWhiteSpace(feature.Name)) { return(BadRequest("Invalid Feature name")); } using (IFeatureManagementAppTierAPI api = CreateFeatureManagementApi()) { HttpOperationResponse <object> result = await api.PostFeatureWithHttpMessagesAsync(feature); return(CreateResponse <Feature>(result)); } }