예제 #1
0
        private void EditSport(string sportName)
        {
            SportEditViewModel viewModel = new SportEditViewModel(sportName);
            SportEditControl   control   = new SportEditControl(viewModel);
            Window             window    = WindowFactory.CreateByContentsSize(control);

            viewModel.SportEdited += (s, e) =>
            {
                SportEditModel sportEditModel = e.Sport;
                SportEditDTO   sportEditDTO   = Mapper.Map <SportEditModel, SportEditDTO>(sportEditModel);

                using (ISportService service = factory.CreateSportService())
                {
                    ServiceMessage serviceMessage = service.Update(sportEditDTO);
                    RaiseReceivedMessageEvent(serviceMessage.IsSuccessful, serviceMessage.Message);

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

            window.Show();
        }
예제 #2
0
 public SportEditControl(SportEditViewModel viewModel)
 {
     InitializeComponent();
     this.DataContext = viewModel;
 }