Exemplo n.º 1
0
        public static MapSearchResultVM SearchForAddress(MapRequestVM mapRequestVM)
        {
            Validator.ValidateObject(mapRequestVM, new ValidationContext(mapRequestVM), true);
            MapRequest mapRequest = CreateMapRequest(mapRequestVM);

            return(SearchForAddress(mapRequest));
        }
Exemplo n.º 2
0
 public PartialViewResult SearchAddress(MapRequestVM mapRequest)
 {
     try
     {
         MapSearchResultVM mapSearchResult = MapRequests.SearchForAddress(mapRequest);
         return(PartialView(mapSearchResult));
     }
     catch (ValidationException e)
     {
         return(PartialView("ValidationException", e));
     }
 }
Exemplo n.º 3
0
        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);
        }