protected async Task <HttpResponseMessage> Post <RequestType>(UriParameter UriParameters, RequestType BodyParameters = default(RequestType), [CallerMemberName] string MethodName = null, string ControllerName = null)
        {
            var json = Newtonsoft.Json.JsonConvert.SerializeObject(BodyParameters);

            System.Net.Http.StringContent content = new System.Net.Http.StringContent(json, Encoding.UTF8, "application/json");
            var result = await this.httpClient.PostAsync(UrlGenerator(UriParameters, MethodName, ControllerName), content);

            return(result);
        }
        protected async Task <T> Get <T>(UriParameter parameters = null, [CallerMemberName] string MethodName = null, string ControllerName = null)
        {
            var result = await this.httpClient.GetAsync(UrlGenerator(parameters, MethodName, ControllerName));

            if (result.IsSuccessStatusCode)
            {
                return(Newtonsoft.Json.JsonConvert.DeserializeObject <T>(await result.Content.ReadAsStringAsync()));
            }
            else
            {
                return(default(T));
            }
        }
        protected async Task <ResponseType> Post <RequestType, ResponseType>(UriParameter UriParameters, RequestType BodyParameters = default(RequestType), [CallerMemberName] string MethodName = null, string ControllerName = null)
        {
            var json   = Newtonsoft.Json.JsonConvert.SerializeObject(BodyParameters);
            var result = await this.httpClient.PostAsync(UrlGenerator(UriParameters, MethodName, ControllerName), new StringContent(json, Encoding.UTF8, "application/json"));

            if (result.IsSuccessStatusCode)
            {
                return(Newtonsoft.Json.JsonConvert.DeserializeObject <ResponseType>(await result.Content.ReadAsStringAsync()));
            }
            else
            {
                return(default(ResponseType));
            }
        }
        private string UrlGenerator(UriParameter UriParameters, string MethodName, string ControllerName)
        {
            System.Text.StringBuilder sb = new System.Text.StringBuilder();
            string contr = ControllerName != null ? ControllerName : this.ControllerName;

            sb.AppendFormat("{0}/{1}", contr, MethodName);

            if (UriParameters != null)
            {
                int i = 0;
                sb.Append("?");
                foreach (string key in UriParameters.Keys)
                {
                    if (i > 0)
                    {
                        sb.Append("&");
                    }

                    sb.Append(string.Format("{0}={1}", key, UriParameters[key]));
                    i++;
                }
            }
            return(sb.ToString());
        }
        protected async Task <HttpResponseMessage> Get(UriParameter parameters, [CallerMemberName] string MethodName = null, string ControllerName = null)
        {
            var result = await this.httpClient.GetAsync(UrlGenerator(parameters, MethodName, ControllerName));

            return(result);
        }