//---------- EVENTS ----------//
        //----- tbllaypn_ControlButtons -----//
        private void btn_OK_Click(object sender, EventArgs e)
        {
            if (Email.ValidateEmail(tb_ClientEmail.Text) == false || PhoneNumber.IsValidPhoneNumber(tb_ClientPhone.Text) == false)
            {
                MessageBox.Show("Invalid Email or Password!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            Dictionary <string, string> properties = new Dictionary <string, string>();

            properties.Add("gmail", tb_ClientEmail.Text);
            properties.Add("phone", tb_ClientPhone.Text);
            properties.Add("code", tb_ClientCode.Text);
            if (clientBLL.Checkexisted(properties))
            {
                clientVM.Gmail = tb_ClientEmail.Text;
                clientVM.Name  = tb_ClientName.Text;
                clientVM.Phone = tb_ClientPhone.Text;
                if (id == 0)
                {
                    //Add
                    clientBLL.Add(clientVM);
                    MessageBox.Show("Your client has been successfully created!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    myDel();
                    this.Dispose();
                }
                else
                {
                    clientBLL.Update(clientVM);
                    MessageBox.Show("Your client has been successfully updated!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    myDel();
                    this.Dispose();
                }
            }
            else
            {
                MessageBox.Show("Phone or Email has existed!", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Exemple #2
0
 public IActionResult Post([FromBody] Client value)
 {
     return(Json(_clientBLL.Add(value)));
 }