UpdateRecord() public method

public UpdateRecord ( EmployeeRecord record ) : void
record EmployeeRecord
return void
示例#1
0
        /// <summary>
        /// Event handler that gets called when an employee info's property value changed.
        /// </summary>
        private void Employee_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var employeeInfo = sender as EmployeeInfo;

            /// Real world app would do database update operation here.
            var record = _model.GetRecord(employeeInfo.Id);

            if (record != null)
            {
                record.FirstName = employeeInfo.FirstName;
                record.LastName  = employeeInfo.LastName;
                _model.UpdateRecord(record);
            }
        }
示例#2
0
        /// <summary>
        /// If employee info changed and is currently selected, make sure the displayed name and phone are updated too.
        /// </summary>
        private void Employee_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            var employeeInfo = sender as EmployeeInfo;

            var record = _model.GetRecord(employeeInfo.Id);

            if (record != null)
            {
                record.FirstName = employeeInfo.FirstName;
                record.LastName  = employeeInfo.LastName;
                _model.UpdateRecord(record);
            }

            // If the record is currently selected, also update the displayed info of the selection.
            if (employeeInfo.Id == SelectedId)
            {
                Changed(() => SelectedDetails);
            }
        }