Example #1
0
        private Classmate _currentClassmate; // holds classmate being edited

        public ClassmateViewModel(Classmate classmate,
                                  IClassmateRepository classmateRepositoy)
        {
            //classmate entity being edited
            _currentClassmate = classmate;

            //save a reference to the dependency
            _classmateRepositoy = classmateRepositoy;

            //initialize the properties with data from domain model
            this.Name      = _currentClassmate.Name;
            this.Phone     = _currentClassmate.Phone;
            this.Birthdate = _currentClassmate.Birthdate;
        }
        public MainViewModel(
            IClassmateRepository classmateRepository,
            ISeederService seederService,
            INavigation navigation)
        {
            _navigation         = navigation;
            _classmateRepositoy = classmateRepository;
            _seederService      = seederService;

            //subscribe to ClassmateSaved message
            MessagingCenter.Subscribe(this, MessageNames.ClassmateSaved,
                                      (ClassmateViewModel sender, Classmate classmate) => {
                //refresh classmates listview each time an update occurs
                RefreshCommand.Execute(null);
            });
        }
 public SeedDataStoreService(IClassmateRepository repository)
 {
     _repository = repository;
 }