public static MapSearchResultVM SearchForAddress(MapRequestVM mapRequestVM) { Validator.ValidateObject(mapRequestVM, new ValidationContext(mapRequestVM), true); MapRequest mapRequest = CreateMapRequest(mapRequestVM); return(SearchForAddress(mapRequest)); }
public PartialViewResult SearchAddress(MapRequestVM mapRequest) { try { MapSearchResultVM mapSearchResult = MapRequests.SearchForAddress(mapRequest); return(PartialView(mapSearchResult)); } catch (ValidationException e) { return(PartialView("ValidationException", e)); } }
private static MapRequest CreateMapRequest(MapRequestVM mapRequestVM) { double latitude = MapRequestsHelper.ConvertLatitude(mapRequestVM.LatDegrees, mapRequestVM.LatMinutes, mapRequestVM.LatSeconds, mapRequestVM.LatDirection); double longitude = MapRequestsHelper.ConvertLongitude(mapRequestVM.LonDegrees, mapRequestVM.LonMinutes, mapRequestVM.LonSeconds, mapRequestVM.LonDirection); var mapRequest = new MapRequest(mapRequestVM.Email, latitude, longitude, DateTime.Now); using (MediatelModel context = new MediatelModel()) { context.MapRequests.Add(mapRequest); context.SaveChanges(); } return(mapRequest); }