private bool ValidateUserType() { if (this.cbxNewUserType.SelectedItem is null) { return(false); } UserType selectedUserType = UserTypeProvider.GetFromString(this.cbxNewUserType.SelectedItem.ToString()); return(selectedUserType != ToBeEdited.Type); }
public Func <string, bool> GetUserTypeValidationFunc() { return((userTypeString) => { try { UserType userType = UserTypeProvider.GetFromString(userTypeString); return true; } catch (ArgumentException ex) when(ex.ParamName == nameof(userTypeString)) { return false; } }); }