diff --git a/Magazyn_Client/Magazyn/DataModels/WarehousePrice.cs b/Magazyn_Client/Magazyn/DataModels/WarehousePrice.cs
new file mode 100644
index 0000000..93c6173
--- /dev/null
+++ b/Magazyn_Client/Magazyn/DataModels/WarehousePrice.cs
@@ -0,0 +1,27 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Magazyn.DataModels
+{
+ class WarehousePrice
+ {
+ float price;
+
+ public float Price
+ {
+ get
+ {
+ return price;
+ }
+ }
+
+ public WarehousePrice( [JsonProperty("price-of-all")] float price)
+ {
+ this.price = price;
+ }
+ }
+}
diff --git a/Magazyn_Client/Magazyn/Magazyn.csproj b/Magazyn_Client/Magazyn/Magazyn.csproj
index 35fe037..14f524c 100644
--- a/Magazyn_Client/Magazyn/Magazyn.csproj
+++ b/Magazyn_Client/Magazyn/Magazyn.csproj
@@ -58,6 +58,7 @@
Designer
+
FruitView.xaml
diff --git a/Magazyn_Client/Magazyn/MainWindow.xaml.cs b/Magazyn_Client/Magazyn/MainWindow.xaml.cs
index a487ae9..f53a504 100644
--- a/Magazyn_Client/Magazyn/MainWindow.xaml.cs
+++ b/Magazyn_Client/Magazyn/MainWindow.xaml.cs
@@ -69,16 +69,19 @@ namespace Magazyn
}
}
- private string GetWarehousePrice()
+ private WarehousePrice GetWarehousePrice()
{
Task response = client.GetAsync("https://sysmag.herokuapp.com/api/get-price-of-all");
while (response.IsCompleted != true) ;
- return response.Result.Content.ReadAsStringAsync().Result.ToString();
+
+ WarehousePrice price = JsonConvert.DeserializeObject(response.Result.Content.ReadAsStringAsync().Result.ToString());
+
+ return price;
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
- MessageBox.Show("Value of warehouse: " + GetWarehousePrice());
+ MessageBox.Show("Value of warehouse: " + GetWarehousePrice().Price.ToString() );
}
}
}