-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from ArnoldV/develop
Release 2.1.0
- Loading branch information
Showing
9 changed files
with
84 additions
and
11 deletions.
There are no files selected for viewing
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
59 changes: 59 additions & 0 deletions
59
Our.Umbraco.GMaps.UmbracoV10/Controllers/MapTestController.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
using Microsoft.AspNetCore.Mvc; | ||
using Newtonsoft.Json; | ||
using Our.Umbraco.GMaps.Models; | ||
using Umbraco.Cms.Core.Services; | ||
using Umbraco.Cms.Web.Common.Controllers; | ||
|
||
namespace Our.Umbraco.GMaps.UmbracoV10.Controllers | ||
{ | ||
public class MapTestController : UmbracoApiController | ||
{ | ||
private readonly IContentService contentService; | ||
|
||
public MapTestController(IContentService contentService) | ||
{ | ||
this.contentService = contentService; | ||
} | ||
|
||
public IActionResult CreateMapEntry() | ||
{ | ||
double lat = -35.23989947459226; | ||
double lng = 149.149934680426; | ||
Map gmap = new() | ||
{ | ||
Address = new Address | ||
{ | ||
Coordinates = new Location | ||
{ | ||
Latitude = lat, | ||
Longitude = lng | ||
} | ||
}, | ||
MapConfig = new MapConfig | ||
{ | ||
Zoom = 15, | ||
CenterCoordinates = new Location | ||
{ | ||
Latitude = lat, | ||
Longitude = lng | ||
} | ||
} | ||
}; | ||
|
||
string json = JsonConvert.SerializeObject(gmap); | ||
|
||
//Hack to get zoom to an int. Probably bug that's a string in model. | ||
//If a string the map won't show up and there is an error saying that zoom is not an int. | ||
json = json.Replace("\"zoom\":\"15\"", "\"zoom\":15"); | ||
|
||
var testContent = contentService.GetRootContent(); | ||
foreach (var n in testContent) | ||
{ | ||
n.SetValue("singleMap", json); | ||
contentService.SaveAndPublish(n); | ||
} | ||
|
||
return Ok(); | ||
} | ||
} | ||
} |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters