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

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