public ActionResult AddEmployee(Employee employee) { if (!ModelState.IsValid) { return(AddEmployee(employee)); } else { int employeID = insertObjectToDB.GetEmployeeIdAndInsertToDB(employee.employee_name); return(RedirectToAction("Index", "Reservation", new { visibleTrue = false })); } }
private void BtnAddEmployee_Click(object sender, EventArgs e) { int employeID = -1; if (tscmbEmployee.ComboBox.SelectedIndex == 0) { employeID = insertObjectToDB.GetEmployeeIdAndInsertToDB(tstxbEmployeeName.TextBox.Text); ComboBoxSetData.SetDataToCmbEmployee(tscmbEmployee.ComboBox); } else { MessageBox.Show("Nie można dodać nowego pracownika"); } }