/// <summary>
        /// Initializes a new instance of the ParticipantsViewModel class.
        /// </summary>
        public ParticipantsViewModel(IParticipantService participantService)
        {
            _participantService = participantService;

            var ops = new ObservableCollection <ParticipantViewModel>();

            _participantService.GetAll((ps, error) =>
            {
                if (error != null)
                {
                    // Report error here
                    return;
                }

                foreach (var p in ps)
                {
                    ops.Add(new ParticipantViewModel
                    {
                        Id        = p.Id,
                        FirstName = p.FirstName,
                        LastName  = p.LastName,
                        Company   = p.Company
                    }
                            );
                }

                Participants = ops;
            });
        }
        /// <summary>
        /// Initializes a new instance of the ParticipantsViewModel class.
        /// </summary>
        public ParticipantsViewModel(IParticipantService participantService)
        {
            _participantService = participantService;

            var ops = new ObservableCollection <ParticipantViewModel>();

            _participantService.GetAll((ps, error) =>
            {
                if (error != null)
                {
                    // Report error here
                    return;
                }

                foreach (var p in ps)
                {
                    ops.Add(new ParticipantViewModel
                    {
                        Id        = p.Id,
                        FirstName = p.FirstName,
                        LastName  = p.LastName,
                        Company   = p.Company
                    }
                            );
                }

                Participants = ops;
            });


            Messenger.Default.Register <ParticipantDeletedMessage>(this, message =>
            {
                var participant = Participants.FirstOrDefault(p => p.Id == message.ParticipantId);
                if (participant != null)
                {
                    Participants.Remove(participant);
                }
            }
                                                                   );
        }
        public async Task <IHttpActionResult> GetAll()
        {
            var participants = await _participantService.GetAll();

            return(Ok(participants));
        }
        public override IEnumerable <ParticipantDisplayModel> GetAll()
        {
            IEnumerable <ParticipantDisplayModel> participantModels = null;

            using (IParticipantService service = factory.CreateParticipantService())
            {
                DataServiceMessage <IEnumerable <ParticipantBaseDTO> > serviceMessage = service.GetAll();

                RaiseReveivedMessageEvent(serviceMessage.IsSuccessful, serviceMessage.Message);
                if (serviceMessage.IsSuccessful)
                {
                    IEnumerable <ParticipantBaseDTO> participantDTOs = serviceMessage.Data;
                    participantModels = participantDTOs.Select(participantDTO => Mapper.Map <ParticipantBaseDTO, ParticipantDisplayModel>(participantDTO));
                }
                else
                {
                    participantModels = new List <ParticipantDisplayModel>();
                }
            }

            return(participantModels);
        }