private void Button_Click(object sender, RoutedEventArgs e) { int updateEmployID = Convert.ToInt32(txtEmpId.Text); Employ updatedEmploy = EmployBL.SearchEmployBL(updateEmployID); if (updatedEmploy != null) { updatedEmploy.EmployName = txtEmpname.Text; updatedEmploy.Department = txtDepartment.Text; updatedEmploy.Salary = Convert.ToInt32(txtSalary.Text); bool employUpdated = EmployBL.UpdateEmployBL(updatedEmploy); if (employUpdated) { MessageBox.Show("Record Updated..."); } } }
private static void UpdateEmploy() { try { int updateEmployID; Console.WriteLine("Enter EmployID to Update Details:"); updateEmployID = Convert.ToInt32(Console.ReadLine()); Employ updatedEmploy = EmployBL.SearchEmployBL(updateEmployID); if (updatedEmploy != null) { Console.WriteLine("Update Employ Name :"); updatedEmploy.EmployName = Console.ReadLine(); Console.WriteLine("Update Employ Department "); updatedEmploy.Department = Console.ReadLine(); Console.WriteLine("Update Salary :"); updatedEmploy.Salary = Convert.ToInt32(Console.ReadLine()); bool employUpdated = EmployBL.UpdateEmployBL(updatedEmploy); if (employUpdated) { Console.WriteLine("Employ Details Updated"); } else { Console.WriteLine("Employ Details not Updated "); } } else { Console.WriteLine("No Employ Details Available"); } } catch (EmployException ex) { Console.WriteLine(ex.Message); } }