示例#1
0
        private void Edit(ParticipantDisplayModel participantDisplayModel, IEnumerable <string> countries, IEnumerable <string> sports)
        {
            ParticipantInfoViewModel viewModel = new ParticipantInfoViewModel(participantDisplayModel, sports, countries);
            ParticipantInfoControl   control   = new ParticipantInfoControl(viewModel);
            Window window = WindowFactory.CreateByContentsSize(control);

            viewModel.ParticipantEdited += (s, e) =>
            {
                ParticipantEditModel participantEditModel = e.Participant;
                ParticipantEditDTO   participantEditDTO   = Mapper.Map <ParticipantEditModel, ParticipantEditDTO>(participantEditModel);

                using (IParticipantService service = factory.CreateParticipantService())
                {
                    ServiceMessage serviceMessage = service.Update(participantEditDTO);
                    RaiseReceivedMessageEvent(serviceMessage.IsSuccessful, serviceMessage.Message);

                    if (serviceMessage.IsSuccessful)
                    {
                        window.Close();
                        Notify();
                    }
                }
            };

            window.Show();
        }
 public ParticipantInfoControl(ParticipantInfoViewModel viewModel)
 {
     InitializeComponent();
     this.DataContext = viewModel;
 }