3 Schichten Architektur voll
Erik hat die 3 Schichten arschitektur voll fertig gemacht wenn jemand sachen added OHNE sie zu beachten gibts stress
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
@@ -12,11 +13,18 @@ namespace bib_talk.Repository
|
||||
{
|
||||
public class MainWindowDatabase
|
||||
{
|
||||
MainWindow mainWindow;
|
||||
private MainWindow mainWindow;
|
||||
private string loggedinUser;
|
||||
|
||||
public MainWindowDatabase(MainWindow mainWindow)
|
||||
public MainWindowDatabase(MainWindow mainWindow)
|
||||
{
|
||||
this.mainWindow = mainWindow;
|
||||
}
|
||||
|
||||
public MainWindowDatabase(MainWindow mainWindow, string user)
|
||||
{
|
||||
this.mainWindow = mainWindow;
|
||||
loggedinUser = user;
|
||||
}
|
||||
|
||||
public async void SendMessage()
|
||||
@@ -81,9 +89,6 @@ namespace bib_talk.Repository
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public async void LogoutUser()
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
@@ -99,5 +104,25 @@ namespace bib_talk.Repository
|
||||
mainWindow.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async Task UploadProfileImage(string filePath)
|
||||
{
|
||||
using (var client = new HttpClient())
|
||||
{
|
||||
var form = new MultipartFormDataContent();
|
||||
var stream = File.OpenRead(filePath);
|
||||
form.Add(new StreamContent(stream), "file", Path.GetFileName(filePath));
|
||||
|
||||
var response = await client.PostAsync($"http://daddypig.dns.navy:5114/api/users/upload-profile-image?username={loggedinUser}", form);
|
||||
if (response.IsSuccessStatusCode)
|
||||
{
|
||||
MessageBox.Show("Profilbild erfolgreich hochgeladen");
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBox.Show("Fehler beim Hochladen des Profilbilds");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user