51 lines
1.6 KiB
C#
51 lines
1.6 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using uWine.Core.Domain.Entities;
|
|
using uWine.Core.Domain.Repositories;
|
|
using uWine.Core.Infrastructure.Helpers;
|
|
using uWine.Core.Infrastructure.Repository;
|
|
|
|
namespace uWine.Core.Infrastructure.Services
|
|
{
|
|
public class CoordinatesService
|
|
{
|
|
public IVineyardRepository _vineyardRepository;
|
|
|
|
public CoordinatesService(IVineyardRepository vineyardRepository)
|
|
{
|
|
_vineyardRepository = vineyardRepository;
|
|
}
|
|
|
|
//public async Task<Coordinates> GetCoordinatesAsync(int vineyardId)
|
|
//{
|
|
// var vineyard = await _vineyardRepository.GetVineyardByIdAsync(vineyardId);
|
|
// if (vineyard == null)
|
|
// {
|
|
// throw new ArgumentException("Vineyard not found");
|
|
// }
|
|
|
|
// return new Coordinates(vineyard.Latitude, vineyard.Longitude);
|
|
//}
|
|
|
|
//public Dictionary<int, Coordinates> VineyardCoordinates(int vineyardId)
|
|
//{
|
|
// return new Dictionary<int, Coordinates>();
|
|
//}
|
|
|
|
public void SaveArea(int vineyardId, Dictionary<int, Coordinates> coordinates)
|
|
{
|
|
_vineyardRepository.InsertArea(coordinates, vineyardId);
|
|
}
|
|
|
|
public Dictionary<int, Coordinates> GetArea(int vineyardId)
|
|
{
|
|
var dict = new Dictionary<int, Coordinates>();
|
|
dict = CoordinatesHelper.WktPolygonToDictionary(_vineyardRepository.Area(vineyardId));
|
|
return dict;
|
|
}
|
|
}
|
|
}
|