예제 #1
0
        /**
         * Entity Action call (a service operation that returns entities and may produce side effects)
         */
        public async Task <JToken> CallEntityActionAsync(string actionName, Dictionary <string, object> paramsObject, string returnTypeName)
        {
            var paramsQueryString = DataAdapterUtils.CreateParamsQueryString(paramsObject);

            var url = this.apiUrl + "/operations/" + actionName + "?" + paramsQueryString;

            var response = await this.client.PostAsync(url, null);;

            if (response.IsSuccessStatusCode)
            {
                var json = await response.Content.ReadAsStringAsync();

                var resultToken = JToken.Parse(json);
                return(resultToken);
            }
            return(null);
        }
예제 #2
0
        /**
         * Entity Function call (a service operation that returns entities and has no side effects)
         */
        public async Task <JToken> CallEntityFunctionAsync(string functionName, Dictionary <string, object> paramsObject, QueryObject queryObject, string returnTypeName, bool returnCollection)
        {
            queryObject.Count = returnCollection;
            var paramsQueryString = DataAdapterUtils.CreateParamsQueryString(paramsObject);

            var url = this.apiUrl + "/operations/" + functionName + "?" + paramsQueryString + "&" + QueryUtils.RenderQueryString(queryObject);

            var response = await this.client.GetAsync(url);

            if (response.IsSuccessStatusCode)
            {
                var json = await response.Content.ReadAsStringAsync();

                var resultToken = JToken.Parse(json);
                return(resultToken);
            }
            return(null);
        }