Open-source eCommerce platform for C# and ASP.NET Core 10 with MongoDB. Build multi-store shops and multi-vendor marketplaces with B2B/B2C, REST API, plugins, Vue 3 and Docker.
C# aspnet-corecsharpdockerdotnetecommerceecommerce-platformmongodbmulti-storemulti-vendornosqlonline-shopshoppingcart
Replace GeoJson2DCoordinates to GeoCoordinates
KrzysztofPajak3a5845d32742
diff --git a/src/Business/Grand.Business.Marketing/Services/Customers/CustomerCoordinatesService.cs b/src/Business/Grand.Business.Marketing/Services/Customers/CustomerCoordinatesService.csindex 75dd5ce37..bd32263f6 100644--- a/src/Business/Grand.Business.Marketing/Services/Customers/CustomerCoordinatesService.cs+++ b/src/Business/Grand.Business.Marketing/Services/Customers/CustomerCoordinatesService.cs@@ -35,6 +35,9 @@ namespace Grand.Business.Marketing.Services.Customersif (customer == null)throw new ArgumentNullException(nameof(customer));+ if (customer.Coordinates == null)+ await Task.FromResult((0, 0));+return await Task.FromResult((customer.Coordinates.X, customer.Coordinates.Y));}@@ -46,10 +49,10 @@ namespace Grand.Business.Marketing.Services.Customerspublic async Task SaveGeoCoordinate(Customer customer, double longitude, double latitude){var coordinates = new MongoDB.Driver.GeoJsonObjectModel.GeoJson2DCoordinates(longitude, latitude);- customer.Coordinates = coordinates;+ customer.Coordinates = new Domain.Common.GeoCoordinates(coordinates.Y, coordinates.Y);//update customer- await _customerRepository.UpdateField(customer.Id, x => x.Coordinates, coordinates);+ await _customerRepository.UpdateField(customer.Id, x => x.Coordinates, customer.Coordinates);//raise eventawait _mediator.Publish(new CustomerCoordinatesEvent(customer));diff --git a/src/Core/Grand.Domain/Catalog/Product.cs b/src/Core/Grand.Domain/Catalog/Product.csindex b88f4380a..1964ea9d4 100644--- a/src/Core/Grand.Domain/Catalog/Product.cs+++ b/src/Core/Grand.Domain/Catalog/Product.cs@@ -1,8 +1,8 @@+using Grand.Domain.Common;using Grand.Domain.Localization;using Grand.Domain.Permissions;using Grand.Domain.Seo;using Grand.Domain.Stores;-using MongoDB.Driver.GeoJsonObjectModel;using System;using System.Collections.Generic;@@ -561,7 +561,7 @@ namespace Grand.Domain.Catalog/// <summary>/// Gets or sets the coordinates/// </summary>- public GeoJson2DCoordinates Coordinates { get; set; }+ public GeoCoordinates Coordinates { get; set; }/// <summary>/// Gets or sets the collection of localesdiff --git a/src/Core/Grand.Domain/Common/GeoCoordinates.cs b/src/Core/Grand.Domain/Common/GeoCoordinates.csnew file mode 100644index 000000000..f5f521e50--- /dev/null+++ b/src/Core/Grand.Domain/Common/GeoCoordinates.cs@@ -0,0 +1,21 @@+namespace Grand.Domain.Common+{+ public class GeoCoordinates+ {+ public GeoCoordinates(double x, double y)+ {+ X = x;+ Y = y;+ }++ /// <summary>+ /// Gets the X coordinate.+ /// </summary>+ public double X { get; }++ /// <summary>+ /// Gets the Y coordinate.+ /// </summary>+ public double Y { get; }+ }+}diff --git a/src/Core/Grand.Domain/Customers/Customer.cs b/src/Core/Grand.Domain/Customers/Customer.csindex 550b24fd1..f8539ad3e 100644--- a/src/Core/Grand.Domain/Customers/Customer.cs+++ b/src/Core/Grand.Domain/Customers/Customer.cs@@ -1,6 +1,5 @@using Grand.Domain.Common;using Grand.Domain.Orders;-using MongoDB.Driver.GeoJsonObjectModel;using System;using System.Collections.Generic;@@ -211,7 +210,7 @@ namespace Grand.Domain.Customers/// <summary>/// Gets or sets the coordinates/// </summary>- public GeoJson2DCoordinates Coordinates { get; set; }+ public GeoCoordinates Coordinates { get; set; }/// <summary>/// Gets or sets customer addresses