Ejemplo n.º 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));
     }
 }
Ejemplo n.º 2
0
        private EventosService getEventosService()
        {
            EventosService carService = new EventosService();

            carService.SetSession(ApplicationCore.Instance.SessionFactory.OpenSession());

            return(carService);
        }
Ejemplo n.º 3
0
        private async Task InitializeDataAsync()
        {
            var listaTemp = new List <Evento>();

            if (await VerificarSesion() == true)
            {
                usuariosEventosService = new UsuariosEventosService();
                List <Sesion> sesion = new List <Sesion>();
                sesion = await sesionService.GetSesionDbAsync();

                int idUsuario = await GetIdUsuario();

                listaTemp = await usuariosEventosService.GetEventsByAssistanceAsync(idUsuario);

                foreach (var evento in listaTemp)
                {
                    if (evento.registrado == 1)
                    {
                        evento.textoBoton = "Ver";
                    }
                    else
                    {
                        evento.textoBoton = "Participar";
                    }
                }
            }
            else
            {
                var eventosServices = new EventosService();
                listaTemp = await eventosServices.GetEventosAsync();

                foreach (var evento in listaTemp)
                {
                    evento.textoBoton = "Participar";
                }
            }
            ListaEventos = listaTemp;
            //select from usuario
        }