public ActionResult Create(InmueblateWeb.Models.Evento collection) { try { // TODO: Add insert logic here if (null != Session) { EventoEN evento = new EventoEN(); NuevoInmueblateGenNHibernate.Enumerated.RedSocial.TipoEventoEnum p_filtro = (NuevoInmueblateGenNHibernate.Enumerated.RedSocial.TipoEventoEnum)Enum.Parse(typeof(NuevoInmueblateGenNHibernate.Enumerated.RedSocial.TipoEventoEnum), collection.Categoria); //evento.valor=collection.valor DateTime fecha = new DateTime(); if (collection.Fecha == null) { fecha = DateTime.Now; } else { fecha = DateTime.Parse(collection.Fecha.ToString()); } //collection.Latitud int geoid = servicio.NuevoInmueblate_Geolocalizacion_CrearGeolocalizacion(collection.Longitud, collection.Latitud, "geo1", "pop1"); servicio.NuevoInmueblate_Evento_CrearEvento(collection.Nombre.ToString(), collection.Descripcion.ToString(), fecha, p_filtro, (int)Session["idUsuario"], geoid); return(RedirectToAction("Index")); } else { return(RedirectToAction("Index")); } } catch { return(RedirectToAction("Index")); } }
public ActionResult Edit(int id, InmueblateWeb.Models.Evento collection) { try { // TODO: Add update logic here if (null != Session) { NuevoInmueblateGenNHibernate.Enumerated.RedSocial.TipoEventoEnum p_filtro = (NuevoInmueblateGenNHibernate.Enumerated.RedSocial.TipoEventoEnum)Enum.Parse(typeof(NuevoInmueblateGenNHibernate.Enumerated.RedSocial.TipoEventoEnum), collection.Categoria); //evento.valor=collection.valor EventoEN even = servicio.NuevoInmueblate_Evento_DameEventoPorOID(id); GeolocalizacionEN geo = servicio.NuevoInmueblate_Geolocalizacion_DameGeolocalizacionPorOID(even.Geolocalizacion.Id); servicio.NuevoInmueblate_Geolocalizacion_ModificarGeolocalizacion(geo.Id, collection.Longitud, collection.Latitud, geo.Direccion, geo.Poblacion); servicio.NuevoInmueblate_Evento_ModificarEvento(id, collection.Nombre.ToString(), collection.Descripcion.ToString(), DateTime.Parse(collection.Fecha), p_filtro); } return(RedirectToAction("Index")); } catch { return(RedirectToAction("Index")); } }