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); }
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(); } }