public async Task <bool> Delete(int id) { tablePackagesGUI = TablePackagesGUI.Instance; bool res = false; bCtrl = new BaseController(); using (var client = bCtrl.GetClient()) { var response = await client.DeleteAsync(bCtrl.BaseUrl + "tablePackages/" + id); string result = response.Content.ReadAsStringAsync().Result; res = true; tablePackagesGUI.AddDataToTable(); return(res); } }
public async Task <bool> Create(TablePackage tablePackage) { tablePackagesGUI = TablePackagesGUI.Instance; bool res = false; bCtrl = new BaseController(); var root = new { TablePackage = tablePackage }; var json = JsonConvert.SerializeObject(root); var data = new StringContent(json, Encoding.UTF8, "application/json"); using (var client = bCtrl.GetClient()) { var response = await client.PostAsync(bCtrl.BaseUrl + "tablePackages/", data); string result = response.Content.ReadAsStringAsync().Result; res = true; } tablePackagesGUI.AddDataToTable(); return(res); }