Ejemplo n.º 1
0
        private void DishFormDoneButton_Click(object sender, EventArgs e)
        {
            if (dish == null)
            {
                Dishes addedDish = new Dishes();

                addedDish.Name        = nameTextBox.Text;
                addedDish.Description = descriptionTextBox.Text;
                addedDish.Price       = Convert.ToDecimal(priceTextBox.Text);

                RequestHelper.MakePostRequest("http://localhost:51894/api/dishes", addedDish);
                MessageBox.Show("Dish added");
            }
            else
            {
                Dishes editedDish = dish;

                editedDish.Name        = nameTextBox.Text;
                editedDish.Description = descriptionTextBox.Text;
                editedDish.Price       = Convert.ToDecimal(priceTextBox.Text);

                RequestHelper.MakePutRequest("http://localhost:51894/api/dishes", editedDish);
                MessageBox.Show("Dish edited");
            }

            Close();
        }
Ejemplo n.º 2
0
        public DishForm(Dishes d)
        {
            InitializeComponent();

            nameTextBox.Text        = d.Name;
            descriptionTextBox.Text = d.Description;
            priceTextBox.Text       = d.Price.ToString();
            dish = d;
        }