Example #1
0
        void deleteUser(User user)
        {
            foreach (TmpAnnouncement announcement in tmpAnnouncementRepository.getBySellerId(user.id))
            {
                tmpAnnouncementRepository.delete(announcement);
            }
            foreach (Announcement announcement in announcementRepository.getBySellerId(user.id))
            {
                announcementRepository.delete(announcement);
            }

            userRepository.delete(user);
        }
Example #2
0
        public void deleteUser()
        {
            DialogWindow dialogWindow = new DialogWindow();

            dialogWindow.DataContext = this;
            Message = $"Уверены, что хотите удалить пользователя {CurrentUser.User.FirstName} {CurrentUser.User.FirstName}?";
            dialogWindow.ShowDialog();
            if (dialogWindow.DialogResult == true)
            {
                foreach (TmpAnnouncement announcement in tmpAnnouncementRepository.getBySellerId(user.id))
                {
                    tmpAnnouncementRepository.delete(announcement);
                }
                foreach (Announcement announcement in announcementRepository.getBySellerId(user.id))
                {
                    announcementRepository.delete(announcement);
                }

                App.mainWindow.Close();
                userRepository.delete(CurrentUser.User);
                App.authWindow = new AuthWindow();
                App.authWindow.Show();
            }
        }