Commit fbf2e42b authored by Kirill's avatar Kirill

Fetching estates

parent 6c89ad6c
using System.Net.Http;
using Ninject;
namespace TourDataManager {
public class GetEstatesUseCase {
[Inject]
public HttpClient httpClient{ get; set; }
public async void GetEstates(){
var response = await httpClient.GetAsync("https://biganto.com/api-novus/estates.getList?client=desktopplayer&client_version=3.0&v=2.0");
var content = await response.Content.ReadAsStringAsync();
Debug.Log(content);
}
}
}
\ No newline at end of file
...@@ -22,6 +22,10 @@ namespace TourDataManager { ...@@ -22,6 +22,10 @@ namespace TourDataManager {
cookiestor.Save(); cookiestor.Save();
}); });
} }
public void GetEstates(){
Container.Get<GetEstatesUseCase>().GetEstates();
}
} }
public class MyModule : NinjectModule { public class MyModule : NinjectModule {
...@@ -44,6 +48,7 @@ namespace TourDataManager { ...@@ -44,6 +48,7 @@ namespace TourDataManager {
Bind<HttpClientHandler>().ToConstant(httpClientHandler).InSingletonScope(); Bind<HttpClientHandler>().ToConstant(httpClientHandler).InSingletonScope();
Bind<HttpClient>().ToConstant(httpClient).InSingletonScope(); Bind<HttpClient>().ToConstant(httpClient).InSingletonScope();
Bind<IAuthenticator>().To<Authenticator>().InSingletonScope(); Bind<IAuthenticator>().To<Authenticator>().InSingletonScope();
Bind<GetEstatesUseCase>().ToSelf().InSingletonScope();
} }
} }
......
...@@ -105,6 +105,7 @@ ...@@ -105,6 +105,7 @@
<Compile Include="Debug.cs" /> <Compile Include="Debug.cs" />
<Compile Include="Entities\Estate.cs" /> <Compile Include="Entities\Estate.cs" />
<Compile Include="Entities\Tour.cs" /> <Compile Include="Entities\Tour.cs" />
<Compile Include="GetEstatesUseCase.cs" />
<Compile Include="IAuthenticator.cs" /> <Compile Include="IAuthenticator.cs" />
<Compile Include="Properties\AssemblyInfo.cs" /> <Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="TourDataManager.cs" /> <Compile Include="TourDataManager.cs" />
......
...@@ -11,10 +11,12 @@ namespace TourDataManagerConsoleApplication { ...@@ -11,10 +11,12 @@ namespace TourDataManagerConsoleApplication {
public static void Main(string[] args){ public static void Main(string[] args){
//var tourDataManager = new TourDataManager.TourDataManager(PersistentPath); var tourDataManager = new TourDataManager.TourDataManager(PersistentPath);
//tourDataManager.Login(defaultLogin, defaultPassword); //tourDataManager.Login(defaultLogin, defaultPassword);
new Db(); //new Db();
tourDataManager.GetEstates();
Console.Read(); Console.Read();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment