Einstellungsbutton Update
Macht es möglich einen Delete Request an den Server zu senden um den Chat zu löschen
This commit is contained in:
parent
4edc2f2188
commit
c390dfe5e3
@ -39,6 +39,12 @@ namespace bib_talk.Business
|
|||||||
mwDatabase.LogoutUser();
|
mwDatabase.LogoutUser();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Methode zum Löschen des Gesamten Chats
|
||||||
|
public void DeleteMessages()
|
||||||
|
{
|
||||||
|
mwDatabase.ClearMessages();
|
||||||
|
}
|
||||||
|
|
||||||
// Methode zum Hochladen eines Profilbildes via Datenbankmanager
|
// Methode zum Hochladen eines Profilbildes via Datenbankmanager
|
||||||
public async Task UploadProfileImage(string filePath)
|
public async Task UploadProfileImage(string filePath)
|
||||||
{
|
{
|
||||||
|
@ -86,6 +86,33 @@ namespace bib_talk.Repository
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public async void ClearMessages()
|
||||||
|
{
|
||||||
|
using (var client = new HttpClient())
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
// Sending a DELETE request to the clear messages endpoint
|
||||||
|
var response = await client.DeleteAsync("http://daddypig.dns.navy:5114/api/messages/clear");
|
||||||
|
|
||||||
|
if (response.IsSuccessStatusCode)
|
||||||
|
{
|
||||||
|
// Log success message or take any other action as needed
|
||||||
|
MessageBox.Show("Alle Nachrichten wurden gelöscht");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Log failure message with the status code
|
||||||
|
MessageBox.Show($"Fehler beim Löschen der Nachrichten. Status code: {response.StatusCode}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
// Handle any exceptions that occur during the request
|
||||||
|
Console.WriteLine($"Ein Fehler ist aufgetreten: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Methode zum Ausloggen des Users via Datenbank
|
// Methode zum Ausloggen des Users via Datenbank
|
||||||
public async void LogoutUser()
|
public async void LogoutUser()
|
||||||
|
@ -89,7 +89,7 @@ namespace bib_talk
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Ohne Funktion
|
#region Ohne Funktion (Fast)
|
||||||
// Chat Settings Logik
|
// Chat Settings Logik
|
||||||
private void MenuButton_Click(object sender, RoutedEventArgs e)
|
private void MenuButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
@ -104,7 +104,8 @@ namespace bib_talk
|
|||||||
|
|
||||||
private void clearChatButton_Click(object sender, RoutedEventArgs e)
|
private void clearChatButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
// Logik zum Löschen eines Chats
|
//Rufe die Methode zum Löschen des Chats auf
|
||||||
|
mwManager.DeleteMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void helpButton_Click(object sender, RoutedEventArgs e)
|
private void helpButton_Click(object sender, RoutedEventArgs e)
|
||||||
|
Loading…
Reference in New Issue
Block a user