Exemplo n.º 1
0
        public UIElement GetDisplayElement()
        {
            ParticipantListViewModel viewModel = new ParticipantListViewModel(this, facade);
            ParticipantListControl   control   = new ParticipantListControl(viewModel);

            viewModel.ParticipantSelected += (s, e) =>
            {
                DataServiceMessage <IEnumerable <string> > countryServiceMessage;
                DataServiceMessage <IEnumerable <string> > sportServiceMessage;

                using (ICountryService service = factory.CreateCountryService())
                {
                    countryServiceMessage = service.GetAll();
                    RaiseReceivedMessageEvent(countryServiceMessage.IsSuccessful, countryServiceMessage.Message);
                }
                using (ISportService service = factory.CreateSportService())
                {
                    sportServiceMessage = service.GetAll();
                    RaiseReceivedMessageEvent(sportServiceMessage.IsSuccessful, sportServiceMessage.Message);
                }

                if (countryServiceMessage.IsSuccessful && sportServiceMessage.IsSuccessful)
                {
                    var countries = countryServiceMessage.Data;
                    var sports    = sportServiceMessage.Data;

                    Edit(e.Participant, countries, sports);
                }
            };
            viewModel.ParticipantDeleteRequest += (s, e) => Delete(e.Participant);

            return(control);
        }
Exemplo n.º 2
0
        public ActionResult Create()
        {
            ParticipantListViewModel participantListViewModel = new ParticipantListViewModel();

            participantListViewModel.ParticipantList = participantList;
            ParticipantCreateViewModel model = new ParticipantCreateViewModel
            {
                Participant     = new ParticipantViewModel(),
                ParticipantList = participantListViewModel
            };

            return(View(model));
        }
Exemplo n.º 3
0
 public ParticipantListControl(ParticipantListViewModel viewModel)
 {
     InitializeComponent();
     this.DataContext = viewModel;
 }