Beispiel #1
0
 public ActionResult GuardarEvento(EventoViewModel vm)
 {
     if (ModelState.IsValid)
     {
         try
         {
             Mapper.CreateMap <EventoViewModel, Evento>();
             var evento = Mapper.Map <Evento>(vm);
             //evento.TheGeom = "ST_GeomFromText('POINT({" + evento.Longitud + "} {" + evento.Latitud + "})', 4326)";
             //evento.TheGeom = "0101000020E61000009D853DEDF01D4DC0B9252834FF9541C0";
             //evento.Id = null;
             EventosService eService = getEventosService();
             eService.CreateEvento(evento);
             // TODO: Add update logic here
             var delitoService = new TipoDelitoService();
             vm.TiposDelitos = delitoService.GetAll();
             return(RedirectToAction("Consulta"));
         }
         catch
         {
             var delitoService = new TipoDelitoService();
             vm.TiposDelitos = delitoService.GetAll();
             return(View("Alta", vm));
         }
     }
     else
     {
         var delitoServices = new TipoDelitoService();
         vm.TiposDelitos = delitoServices.GetAll();
         return(View("Alta", vm));
     }
 }
Beispiel #2
0
        //
        // GET: /Evento/Details/5

        public ActionResult Alta()
        {
            var viewModel     = new EventoViewModel();
            var delitoService = new TipoDelitoService();

            viewModel.TiposDelitos = delitoService.GetAll();
            return(View(viewModel));
        }