Ejemplo n.º 1
0
        /// <summary>
        /// Event to handle adding new employee
        /// </summary>
        private async void btnEmpAdd_Click(object sender, EventArgs e)
        {
            try
            {
                if (ValidateControls((Button)sender))
                {
                    EmployeeAdd newEmployee = new EmployeeAdd();
                    newEmployee.name   = txtEmpName.Text.Trim();
                    newEmployee.email  = txtEmpEmail.Text.Trim();
                    newEmployee.gender = cboEmpGender.SelectedItem.ToString();
                    newEmployee.status = cboEmpStatus.SelectedItem.ToString();
                    var response = await RESTApiHelper.Post(newEmployee);

                    //DeserializeJsonforSingleSearch(response);
                    LoadCurrentPage(Convert.ToInt32(lblPages.Text));
                    //ListAllEmployees();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, AppName);
            }
        }