private void ExecuteLoad(object obj) { if (obj != null) { if (!StaffList.Any(x => x.BARCODE == obj.ToString())) { MessageBox.Show("Invalid Id.", MessageBoxCaption, MessageBoxButton.OK, MessageBoxImage.Exclamation); return; } SelectedStaff = StaffList.FirstOrDefault(x => x.BARCODE == obj.ToString()); } staff = new Staff { BARCODE = SelectedStaff.BARCODE, FULLNAME = SelectedStaff.FULLNAME, ADDRESS = SelectedStaff.ADDRESS, DESIGNATION = SelectedStaff.DESIGNATION, REMARKS = SelectedStaff.REMARKS, STATUS = SelectedStaff.STATUS, BCODE = SelectedStaff.BCODE }; SetAction(ButtonAction.Selected); }
public StaffModel GetStaff(int staffId) { return(!StaffList.Any() ? null : StaffList.FirstOrDefault(x => x.Id == staffId)); }