Пример #1
0
        public async Task <string> CreateAsync(CharacterCreateDTO character)
        {
            var response = await _client.PostAsync("api/characters", character.ToHttpContent());

            if (response.IsSuccessStatusCode)
            {
                return(response.Headers.GetValues("Location").First());
            }

            return(null);
        }
Пример #2
0
        public async Task <int> CreateAsync(CharacterCreateDTO character)
        {
            var response = await _client.PostAsync("api/characters", character.ToHttpContent());

            if (response.IsSuccessStatusCode)
            {
                var location = response.Headers.GetValues("Location").First();
                return(int.Parse(location.Split('/').Last()));
            }

            return(-1);
        }