コード例 #1
0
        public async Task <IActionResult> Create([FromQuery] CreateIconFromQuery query,
                                                 [FromBody] CreateIconFromBody body)
        {
            var request = new CreateIconRequest(query, body);

            var result = await _apiResult.Produce(request);

            return(result);
        }
コード例 #2
0
        public static async Task <CreatedRecordResult> CreateIcon(string name, string dataPath)
        {
            var apiVersion = "1.0";
            var body       = new CreateIconFromBody
            {
                Name     = name,
                DataPath = dataPath
            };
            var jsonBody = JsonConvert.SerializeObject(body);

            var response = await _client.PostAsync(string.Format("api/icons?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);
        }
コード例 #3
0
 public CreateIconRequest(CreateIconFromQuery query, CreateIconFromBody body)
 {
     _query = query ?? throw new ArgumentNullException(nameof(query));
     _body  = body ?? throw new ArgumentNullException(nameof(body));
 }