コード例 #1
0
        public async Task <int> CreateAsync <TSource, TDestination>(TSource item) where TSource : class where TDestination : class
        {
            try
            {
                GetProperties(item);
                string uri = FormatUriWithIds <TDestination>();
                token = await _jwt.CheckTokenAsync(token);

                var response = await _http.PostAsync <TSource, TSource>(item, uri, "AdminClient", token.Token);

                return((int)response.GetType().GetProperty("Id").GetValue(response));
            }
            catch
            {
                throw;
            }
        }
コード例 #2
0
        public async Task <int> CreateAsync <TSource, TDestination>(TSource item)
            where TSource : class
            where TDestination : class
        {
            try
            {
                GetProperties(item);
                string uri = FormatUriWithIds <TDestination>();
                _token = await _jwtTokenService.CheckTokenAsync(_token);

                var response = await _http.PostAsync <TSource, TDestination>(item, uri, AppConstants.HttpClientName, _token.Token);

                return((int)response.GetType()
                       .GetProperty("Id")
                       .GetValue(response));
            }
            catch (Exception ex)
            {
                throw;
            }
        }