예제 #1
0
        public async Task <bool> Delete(int id)
        {
            venuesGUI = VenuesGUI.Instance;
            bool res = false;

            bCtrl = new BaseController();
            using (var client = bCtrl.GetClient()) {
                var response = await client.DeleteAsync(bCtrl.BaseUrl + "venues/" + id);

                string result = response.Content.ReadAsStringAsync().Result;
                res = true;
                venuesGUI.AddDataToTable();
                return(res);
            }
        }
예제 #2
0
        public async Task <bool> Create(Venue venue)
        {
            venuesGUI = VenuesGUI.Instance;
            bool res = false;

            bCtrl = new BaseController();
            var root = new {
                Venue = venue
            };
            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 + "venues/", data);

                string result = response.Content.ReadAsStringAsync().Result;
                res = true;
            }
            venuesGUI.AddDataToTable();
            return(res);
        }