Browse Source

Add locationService class

pull/809/head
Christian Arenas 7 years ago
parent
commit
cdd15117fb
4 changed files with 50 additions and 1 deletions
  1. +8
    -0
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Models/Location/LocationRequest.cs
  2. +10
    -0
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/ILocationService.cs
  3. +28
    -0
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/LocationService.cs
  4. +4
    -1
      src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj

+ 8
- 0
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Models/Location/LocationRequest.cs View File

@ -0,0 +1,8 @@
namespace eShopOnContainers.Core.Models.Location
{
public class LocationRequest
{
public double Longitude { get; set; }
public double Latitude { get; set; }
}
}

+ 10
- 0
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/ILocationService.cs View File

@ -0,0 +1,10 @@
namespace eShopOnContainers.Core.Services.Location
{
using System.Threading.Tasks;
using eShopOnContainers.Core.Models.Location;
public interface ILocationService
{
Task UpdateUserLocation(LocationRequest newLocReq);
}
}

+ 28
- 0
src/Mobile/eShopOnContainers/eShopOnContainers.Core/Services/Location/LocationService.cs View File

@ -0,0 +1,28 @@
namespace eShopOnContainers.Core.Services.Location
{
using eShopOnContainers.Core.Models.Location;
using eShopOnContainers.Core.Services.RequestProvider;
using System;
using System.Threading.Tasks;
public class LocationService : ILocationService
{
private readonly IRequestProvider _requestProvider;
public LocationService(IRequestProvider requestProvider)
{
_requestProvider = requestProvider;
}
public async Task UpdateUserLocation(LocationRequest newLocReq)
{
UriBuilder builder = new UriBuilder(GlobalSetting.Instance.LocationEndpoint);
builder.Path = "api/v1/locations";
string uri = builder.ToString();
var result = await _requestProvider.PostAsync(uri, newLocReq);
}
}
}

+ 4
- 1
src/Mobile/eShopOnContainers/eShopOnContainers.Core/eShopOnContainers.Core.csproj View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
@ -70,6 +70,7 @@
<Compile Include="Models\Catalog\CatalogItem.cs" />
<Compile Include="Models\Catalog\CatalogRoot.cs" />
<Compile Include="Models\Catalog\CatalogType.cs" />
<Compile Include="Models\Location\LocationRequest.cs" />
<Compile Include="Models\Navigation\TabParameter.cs" />
<Compile Include="Models\Orders\CardType.CS" />
<Compile Include="Models\Orders\Order.cs" />
@ -91,6 +92,8 @@
<Compile Include="Services\Dialog\IDialogService.cs" />
<Compile Include="Services\Identity\IdentityService.cs" />
<Compile Include="Services\Identity\IIdentityService.cs" />
<Compile Include="Services\Location\ILocationService.cs" />
<Compile Include="Services\Location\LocationService.cs" />
<Compile Include="Services\Navigation\INavigationService.cs" />
<Compile Include="Services\Navigation\NavigationService.cs" />
<Compile Include="Services\OpenUrl\IOpenUrlService.cs" />


Loading…
Cancel
Save