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 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 VineyardCoordinates(int vineyardId) //{ // return new Dictionary(); //} public void SaveArea(int vineyardId, Dictionary coordinates) { _vineyardRepository.InsertArea(coordinates, vineyardId); } public Dictionary GetArea(int vineyardId) { var dict = new Dictionary(); dict = CoordinatesHelper.WktPolygonToDictionary(_vineyardRepository.Area(vineyardId)); return dict; } } }