Esempio n. 1
0
        public static bool InvokePostGlobalAsset(GlobalAsset globalAsset)
        {
            if (globalAsset == null)
            {
                return(false);
            }

            try
            {
                //HttpClient client = new HttpClient();

                //client.BaseAddress = new Uri(GetGlobalRestServiceBaseAddress());

                //client.DefaultRequestHeaders.Accept.Add(
                //    new MediaTypeWithQualityHeaderValue("application/json"));

                //var response = client.PostAsJsonAsync("globalassetsapi", globalAsset).Result;

                //if (response.IsSuccessStatusCode)
                //{
                //    return true;
                //}
                //else
                //{
                //    throw new Exception(response.ReasonPhrase + " : " + response.Content.ReadAsStringAsync().Result);
                //}
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(false);
        }
Esempio n. 2
0
        public static bool InvokePut(GlobalAsset globalAsset)
        {
            try
            {
                //HttpClient client = new HttpClient();

                //client.BaseAddress = new Uri(GetGlobalRestServiceBaseAddress());

                //client.DefaultRequestHeaders.Accept.Add(
                //    new MediaTypeWithQualityHeaderValue("application/json"));

                //var response = client.PutAsJsonAsync("globalassetsapi", globalAsset).Result;

                //if (response.IsSuccessStatusCode)
                //{
                //    return true;
                //}
            }
            catch (Exception)
            {
            }

            return(false);
        }