示例#1
0
        private async Task InsertService()
        {
            if (ValidateInputs())
            {
                ServiceInsertVM serviceInsertVM = new ServiceInsertVM()
                {
                    Name  = TbName.Text,
                    Price = decimal.Parse(TbPrice.Text)
                };

                ls.LblLoading.Text = "Adding";
                ls.Show();
                bool success = await serviceApi.InsertService(serviceInsertVM);

                ls.Close();

                if (success)
                {
                    Close();
                }
                else
                {
                    MessageBox.Show("Fail!");
                }
            }
            else
            {
                MessageBox.Show("All input fields are required and price must be a number!");
            }
        }