예제 #1
0
        private async void DoGetAll()
        {
            var apiUrl        = $"{txtApiPath.Text}/All";
            var apiCallResult = await ApiCrudCallHelper.Get <List <DummyPost> >(apiUrl);

            txtResults.AppendText(apiCallResult.Message);
        }
예제 #2
0
        private async void DoGetId()
        {
            var apiUrl        = $"{txtApiPath.Text}/98745";
            var apiCallResult = await ApiCrudCallHelper.Get <string>(apiUrl);

            txtResults.AppendText(apiCallResult.Message);
        }
예제 #3
0
        private async void DoDelete()
        {
            //not posting any model, should get back a string responce but we can get a model as well (why?)
            //since this is a DELETE call, append the id to the url as well
            var apiUrl        = $"{txtApiPath.Text}/98745";
            var apiCallResult = await ApiCrudCallHelper.Delete <string>(apiUrl);

            txtResults.AppendText(apiCallResult.Message);
        }
예제 #4
0
        private async void DoPost()
        {
            var dp = new  DummyPost {
                Id = 12345, Name = "XYZ"
            };
            //we might be posting one model and getting back another model. Here the same model is getting posted. So .Post<inputModel Type, returnModel Type>
            var apiCallResult = await ApiCrudCallHelper.Post <DummyPost, DummyPost>(dp, txtApiPath.Text);

            txtResults.AppendText(apiCallResult.Message);
        }
예제 #5
0
        private async void DoPut()
        {
            var dp = new DummyPost {
                Id = 12345, Name = "XYZ"
            };
            //we might be posting one model and getting back another model. Here the same model is getting posted. So .Post<inputModel Type, returnModel Type>
            //since this is a PUT call, append the id to the url as well
            var apiUrl        = $"{txtApiPath.Text}/98745";
            var apiCallResult = await ApiCrudCallHelper.Put <DummyPost, DummyPost>(dp, apiUrl);

            txtResults.AppendText(apiCallResult.Message);
        }