private void popBtnAddButton_Click(object sender, RoutedEventArgs e) { if (FormMode == FormModes.View) { this.ActualParent.Close(); return; } SessionEntity.created_by = SessionEntity.updated_by = Utilities.UserSession.UserID; if (FormMode == FormModes.New) { SessionEntity.created_by = Utilities.UserSession.UserID; SessionRepo.Insert(SessionEntity); } else if (FormMode == FormModes.Edit) { SessionRepo.Update(SessionEntity); } var parent = (ucSessionListView)this.ParentContainer; parent.RefreshList(); this.ActualParent.Close(); }