From e115301ea24214b688c26151fefe17c532690fa1 Mon Sep 17 00:00:00 2001 From: Benjamin Ifland Date: Sun, 17 Mar 2019 21:12:43 +0100 Subject: [PATCH] read url from app.config --- API/API.Client.Test/API.Client.Test.csproj | 1 + API/API.Client.Test/App.config | 8 +++++++ API/API.Client/API.Client.csproj | 1 + API/API.Client/Client.cs | 12 ++++++----- API/API/API.csproj | 1 + .../PublishProfiles/CustomProfile.pubxml | 21 +++++++++++++++++++ 6 files changed, 39 insertions(+), 5 deletions(-) create mode 100644 API/API.Client.Test/App.config create mode 100644 API/API/Properties/PublishProfiles/CustomProfile.pubxml diff --git a/API/API.Client.Test/API.Client.Test.csproj b/API/API.Client.Test/API.Client.Test.csproj index 2c32946..96bae9e 100644 --- a/API/API.Client.Test/API.Client.Test.csproj +++ b/API/API.Client.Test/API.Client.Test.csproj @@ -83,6 +83,7 @@ + diff --git a/API/API.Client.Test/App.config b/API/API.Client.Test/App.config new file mode 100644 index 0000000..51bf85b --- /dev/null +++ b/API/API.Client.Test/App.config @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/API/API.Client/API.Client.csproj b/API/API.Client/API.Client.csproj index 1db0940..9bdf586 100644 --- a/API/API.Client/API.Client.csproj +++ b/API/API.Client/API.Client.csproj @@ -59,6 +59,7 @@ ..\packages\Simple.OData.Client.5.6.2\lib\net452\Simple.OData.Client.V4.Adapter.dll + ..\packages\System.Spatial.5.8.4\lib\net40\System.Spatial.dll diff --git a/API/API.Client/Client.cs b/API/API.Client/Client.cs index 8650ccc..aacd004 100644 --- a/API/API.Client/Client.cs +++ b/API/API.Client/Client.cs @@ -3,38 +3,40 @@ using API.Models; using Simple.OData.Client; using System; using System.Collections.Generic; +using System.Configuration; using System.Linq.Expressions; using System.Threading.Tasks; namespace API.Client { public class Client { + private static string url = ConfigurationManager.AppSettings["url"] + "/odata"; public async Task> Get() { - var client = new ODataClient("http://localhost/API/odata").For(); + var client = new ODataClient(url).For(); var songs = await client.FindEntriesAsync(); return songs; } public async Task> Get(Expression> filterExpression) { - var client = new ODataClient("http://localhost/API/odata").For(); + var client = new ODataClient(url).For(); var songs = await client.Filter(filterExpression).FindEntriesAsync(); return songs; } public async Task Get(long id) { - var client = new ODataClient("http://localhost/API/odata").For(); + var client = new ODataClient(url).For(); var song = await client.Key(id).FindEntryAsync(); return song; } public async Task Post(Song song) { - var client = new ODataClient("http://localhost/API/odata").For(); + var client = new ODataClient(url).For(); var insertedSong = await client.Set(song).InsertEntryAsync(); return insertedSong; } public async Task Delete(long id) { - var client = new ODataClient("http://localhost/API/odata").For(); + var client = new ODataClient(url).For(); var count = await client.Key(id).DeleteEntriesAsync(); return count; } diff --git a/API/API/API.csproj b/API/API/API.csproj index ae70463..8f49a25 100644 --- a/API/API/API.csproj +++ b/API/API/API.csproj @@ -161,6 +161,7 @@ + diff --git a/API/API/Properties/PublishProfiles/CustomProfile.pubxml b/API/API/Properties/PublishProfiles/CustomProfile.pubxml new file mode 100644 index 0000000..6ab4733 --- /dev/null +++ b/API/API/Properties/PublishProfiles/CustomProfile.pubxml @@ -0,0 +1,21 @@ + + + + + FTP + Release + Any CPU + + True + True + home472178787.1and1-data.host + False + True + test + u73527913 + <_SavePWD>False + + \ No newline at end of file