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); }
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); }