Ejemplo n.º 1
0
        private void RestWebApiUpdate()
        {
            if (lstRestWebApi.SelectedItems.Count != 1)
            {
                MessageBox.Show("Please select one item in the list.", "REST WebApi - Update");
                return;
            }

            int theId = 0;

            if (int.TryParse((string)lstRestWebApi.SelectedItems[0].Tag, out theId))
            {
                ProxyConfiguration config = new ProxyConfiguration("http://localhost:59876/api");
                IFooRest fooSvc = SimpleProxy.Proxy.For<IFooRest>(config);

                Foo foo = fooSvc.GetById(theId);

                string theBar = BarDialog.ShowDialog(foo.Bar);

                if (null != theBar)
                {
                    foo.Bar = theBar;

                    fooSvc.Update(foo.Id, foo);
                }
            }
            else
            {
                MessageBox.Show("Invalid Foo.", "REST WebApi - Update");

                lstRestWebApi.SelectedItems.Clear();
            }

            RestWebApiRefresh();
        }
Ejemplo n.º 2
0
        private void RestWebApiAdd()
        {
            string bar = BarDialog.ShowDialog(string.Empty);

            ProxyConfiguration config = new ProxyConfiguration("http://localhost:59876/api");
            IFooRest fooSvc = SimpleProxy.Proxy.For<IFooRest>(config);

            fooSvc.Add(new Foo { Bar = bar });

            RestWebApiRefresh();
        }
Ejemplo n.º 3
0
        private void PageMethodsWebFormsAdd()
        {
            string bar = BarDialog.ShowDialog(string.Empty);

            ProxyConfiguration config = new ProxyConfiguration("http://localhost:59878");
            IFooPageMethods fooSvc = SimpleProxy.Proxy.For<IFooPageMethods>(config);

            fooSvc.Add(new AddParameters { foo = new Foo { Bar = bar } });
            //fooSvc.Add(new Foo { Bar = bar });

            PageMethodsWebFormsRefresh();
        }
Ejemplo n.º 4
0
        public static string ShowDialog(string bar)
        {
            BarDialog barDlg = new BarDialog();

            barDlg.txtBar.Text = bar ?? string.Empty;

            DialogResult result = barDlg.ShowDialog();

            if (result == DialogResult.Cancel) return null;

            return barDlg.txtBar.Text;
        }
Ejemplo n.º 5
0
        public static string ShowDialog(string bar)
        {
            BarDialog barDlg = new BarDialog();

            barDlg.txtBar.Text = bar ?? string.Empty;

            DialogResult result = barDlg.ShowDialog();

            if (result == DialogResult.Cancel)
            {
                return(null);
            }

            return(barDlg.txtBar.Text);
        }
Ejemplo n.º 6
0
        private void PageMethodsWebFormsUpdate()
        {
            if (lstPageMethodsWebForms.SelectedItems.Count != 1)
            {
                MessageBox.Show("Please select one item in the list.", "PageMethods WebForms - Update");
                return;
            }

            int theId = 0;

            if (int.TryParse((string)lstPageMethodsWebForms.SelectedItems[0].Tag, out theId))
            {
                ProxyConfiguration config = new ProxyConfiguration("http://localhost:59878");
                IFooPageMethods fooSvc = SimpleProxy.Proxy.For<IFooPageMethods>(config);

                GetFooByIdResponse response = fooSvc.GetById(new FooByIdParameters { id = theId });
                Foo foo = response.D;

                string theBar = BarDialog.ShowDialog(foo.Bar);

                if (null != theBar)
                {
                    foo.Bar = theBar;

                    fooSvc.Update(new UpdateParameters { id = foo.Id, value = foo });
                }
            }
            else
            {
                MessageBox.Show("Invalid Foo.", "PageMethods WebForms - Update");

                lstPageMethodsWebForms.SelectedItems.Clear();
            }

            PageMethodsWebFormsRefresh();
        }