public async Task <IActionResult> Create([FromQuery] CreateSourceFromQuery query, [FromBody] CreateSourceFromBody body) { var request = new CreateSourceRequest(query, body); var result = await _apiResult.Produce(request); return(result); }
public static async Task <CreatedRecordResult> CreateSource(string name, string description) { var apiVersion = "1.0"; var body = new CreateSourceFromBody { Name = name, Description = description, BusinessUnits = null }; var jsonBody = JsonConvert.SerializeObject(body); var response = await _client.PostAsync(string.Format("api/sources?api-version={0}", apiVersion), new StringContent(jsonBody, Encoding.UTF8, "application/json")); var id = response.Headers.Location.GetId(); var eTag = response.Headers.ETag.Tag; var result = new CreatedRecordResult { Id = id, ETag = eTag }; return(result); }
public CreateSourceRequest(CreateSourceFromQuery query, CreateSourceFromBody body) { _query = query ?? throw new ArgumentNullException(nameof(query)); _body = body ?? throw new ArgumentNullException(nameof(body)); }