public async Task <IActionResult> StationRouting(int stationId, int callId) { StationRoutingView model = new StationRoutingView(); var station = await _departmentGroupsService.GetGroupByIdAsync(stationId); var call = await _callsService.GetCallByIdAsync(callId); if (station.DepartmentId != DepartmentId) { Unauthorized(); } if (call.DepartmentId != DepartmentId) { Unauthorized(); } string startLat = ""; string startLon = ""; if (!String.IsNullOrWhiteSpace(station.Latitude) && !String.IsNullOrWhiteSpace(station.Longitude)) { startLat = station.Latitude; startLon = station.Longitude; } else if (station.Address != null) { var location = await _geoLocationProvider.GetLatLonFromAddress(station.Address.FormatAddress()); if (!String.IsNullOrWhiteSpace(location)) { var locationParts = location.Split(char.Parse(",")); startLat = locationParts[0]; startLon = locationParts[1]; } } string endLat = ""; string endLon = ""; var callCocationParts = call.GeoLocationData.Split(char.Parse(",")); endLat = callCocationParts[0]; endLon = callCocationParts[1]; model.StartLat = startLat; model.StartLon = startLon; model.EndLat = endLat; model.EndLon = endLon; return(View(model)); }
public async Task <IActionResult> LiveRouting(int callId) { StationRoutingView model = new StationRoutingView(); var call = await _callsService.GetCallByIdAsync(callId); if (call.DepartmentId != DepartmentId) { Unauthorized(); } string endLat = ""; string endLon = ""; var callCocationParts = call.GeoLocationData.Split(char.Parse(",")); endLat = callCocationParts[0]; endLon = callCocationParts[1]; model.EndLat = endLat; model.EndLon = endLon; return(View(model)); }