/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { MemberList = MembershipData.GetMemberships(); ShowCommand = new RelayCommand(ShowMethod); ShowUpdateWinCommand = new RelayCommand(ShowUpdateWindow); ExitWindowCommand = new RelayCommand <IClosable>(ExitWindow); Messenger.Default.Register <Member>(this, "add", SaveMember); Messenger.Default.Register <Member>(this, "edit", UpdateMember); Messenger.Default.Register <Member>(this, "delete", DeleteMember); }
private void UpdateMember(Member objMember) { // Do validation if (!Validator.IsPresent("First Name", objMember.FirstName) || !Validator.IsPresent("Last Name", objMember.LastName) || !Validator.IsPresent("Email", objMember.Email) || !Validator.IsValidEmail("Email", objMember.Email)) { return; } SelectedMember = objMember; MembershipData.SaveMemberships(MemberList); MemberList = MembershipData.GetMemberships(); this.RaisePropertyChanged(() => this.MemberList); Messenger.Default.Send(new NotificationMessage(objMember.DisplayText + " is updated successfully.")); CloseWindow(objMemberUpdate); }