Ejemplo n.º 1
0
        protected async Task <T> PostDictionary <T>(Dictionary <string, string> dic) where T : class
        {
            try
            {
                string json = await HttpBaseService.PostAsync(ApiUri, dic);

                return(JsonHelper.Deserlialize <T>(json));
            }
            catch (Exception e)
            {
#if DEBUG
                System.Diagnostics.Debug.WriteLine("ApiBaseService.PostDictionary :" + e.Message);
#endif
                return(null);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <param name="uri"></param>
        /// <param name="body"></param>
        /// <returns></returns>
        protected async Task <T> PostJson <T>(string body) where T : class
        {
            try
            {
                string json = await HttpBaseService.PostAsync(ApiUri, body);

                if (json != null)
                {
                    return(JsonHelper.Deserlialize <T>(json));
                }
                return(null);
            }
            catch (Exception e)
            {
#if DEBUG
                System.Diagnostics.Debug.WriteLine(e.Message);
#endif
                return(null);
            }
        }