<commit_before>﻿using System;
using Flip;

namespace ContactList
{
    public class ContactEditorViewModel : ObservableObject
    {
        private Contact _model;
        private string _editName;
        private string _editEmail;

        public ContactEditorViewModel(Contact model)
        {
            _model = model;
            _editName = model.Name;
            _editEmail = model.Email;
        }

        public Contact Model
        {
            get { return _model; }
            set { SetValue(ref _model, value); }
        }

        public string EditName
        {
            get { return _editName; }
            set { SetValue(ref _editName, value); }
        }

        public string EditEmail
        {
            get { return _editEmail; }
            set { SetValue(ref _editEmail, value); }
        }

        public IReactiveCommand SaveCommand => null;
    }
}<commit_msg>ContactEditorViewModel 클래스의 SaveCommand 명령을 구현합니다.<commit_after>﻿using System;
using System.Linq;
using System.Windows;
using Flip;

namespace ContactList
{
    public class ContactEditorViewModel : ObservableObject
    {
        private Contact _model;
        private string _editName;
        private string _editEmail;

        public ContactEditorViewModel(Contact model)
        {
            _model = model;
            _editName = model.Name;
            _editEmail = model.Email;
        }

        public Contact Model
        {
            get { return _model; }
            set { SetValue(ref _model, value); }
        }

        public string EditName
        {
            get { return _editName; }
            set { SetValue(ref _editName, value); }
        }

        public string EditEmail
        {
            get { return _editEmail; }
            set { SetValue(ref _editEmail, value); }
        }

        public IReactiveCommand SaveCommand => ReactiveCommand.Create(_ =>
        {
            var newModel = new Contact(_model.Id, _editName, _editEmail);

            MainViewModel mainViewModel =
                Application.Current.MainWindow.DataContext as MainViewModel;

            foreach (ContactViewModel itemViewModel in
                from item in mainViewModel.Contacts
                where item.Model.Id == _model.Id
                select item)
            {
                itemViewModel.Model = newModel;
            }
        });
    }
}
{'fraction_non_alphanumeric': 0.06753355704697987, 'fraction_numerical': 0.0, 'mean_word_length': 1.62954796030871, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1993283', 'n_tokens_mistral': 624, 'n_tokens_neox': 603, 'n_words': 158}