Beispiel #1
0
        public void LoadData()
        {
            CategoriasResponse response = rest.GetAllCategories(token);

            List <Result> categories = response.Result;

            categories.Reverse();

            dtgCategories.DataSource = categories;
            lblTotalCate.Text        = dtgCategories.Rows.Count.ToString();
        }
Beispiel #2
0
        public CategoriasResponse GetCategoryById(String token, int id)
        {
            var client  = new RestClient($"http://159.203.78.14:3000/category/{id}?state=1");
            var request = new RestRequest(Method.GET);

            request.AddHeader("version", "app_v1");
            request.AddHeader("token", token);
            IRestResponse response = client.Execute(request);

            CategoriasResponse categoriasResponse = JsonConvert.DeserializeObject <CategoriasResponse>(response.Content);

            Console.WriteLine(JsonConvert.SerializeObject(categoriasResponse, Formatting.Indented));

            return(categoriasResponse);
        }
        private void FormActualizarCate_Load(object sender, EventArgs e)
        {
            CategoriasResponse response = rest.GetCategoryById(token, Int32.Parse(idCate));

            List <Result> category = response.Result;

            foreach (Result i in category)
            {
                txtCateName.Text = i.Category_name;

                if (Int32.Parse(i.State) == 1)
                {
                    optAvailable.Checked = true;
                }
                else
                {
                    optUnavailable.Checked = true;
                }
            }
        }