4,815 questions
dONE
@model LatLongAddress.Models.LocationModel
@{
Layout = null;
}
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<script type='text/javascript'>
var map, searchManager;
function GetMap() {
map = new Microsoft.Maps.Map('#myMap', {
credentials: 'Au7sMtQzyQZRzuQ2krOIbZg8j2MGoHzzOJAmVym6vQjHq_BJ8a1YQGX3iCosFh8u',
center: new Microsoft.Maps.Location(@ViewData["lat"], @ViewData["long"]),
zoom: 11
});
//Make a request to reverse geocode the center of the map.
reverseGeocode();
}
function reverseGeocode() {
//If search manager is not defined, load the search module.
if (!searchManager) {
//Create an instance of the search manager and call the reverseGeocode function again.
Microsoft.Maps.loadModule('Microsoft.Maps.Search', function () {
searchManager = new Microsoft.Maps.Search.SearchManager(map);
reverseGeocode();
});
} else {
var searchRequest = {
location: map.getCenter(),
callback: function (r) {
//Tell the user the name of the result.
alert(r.name);
},
errorCallback: function (e) {
//If there is an error, alert the user about it.
alert("Unable to reverse geocode location.");
}
};
//Make the reverse geocode request.
searchManager.reverseGeocode(searchRequest);
}
}
</script>
<script type='text/javascript' src='https://www.bing.com/api/maps/mapcontrol?callback=GetMap' async defer></script>
</head>
<body>
<form asp-action="Index">
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
<div class="form-group">
<label asp-for="Location" class="control-label"></label>
<input asp-for="Location" class="form-control" />
<span asp-validation-for="Location" class="text-danger"></span>
</div>
<td><input type="submit" value="Submit" /></td>
</tr>
</table>
<hr />
Local Timë:</br>
@ViewData["timez"] </br>
Location:</br>
@ViewData["loc"]</br>
@ViewData["err"]</br>
Latitude:</br>
@ViewData["lat"] </br>
Longitude:</br>
@ViewData["long"]
<h4> This page calculates local time </h4>
</form>
<div id="myMap" style="position:relative;width:600px;height:400px;"></div>
</body>
</html>