Beispiel #1
0
        public ActionResult Detalle(int id)
        {
            var propuesta = PropuestaService.GetById(id);
            var propuestaDetalleViewModel = new PropuestaDetalleViewModel
            {
                Propuesta  = propuesta,
                Denuncie   = DenunciasService.Denuncie(id),
                Valoracion = PropuestasValoracionesService.Valore(id)
            };

            return(View(propuestaDetalleViewModel));
        }
Beispiel #2
0
        public ActionResult Denunciar(Denuncias denuncia)
        {
            denuncia.FechaCreacion = DateTime.Now;
            denuncia.IdUsuario     = SessionHelper.Usuario.IdUsuario;
            denuncia.Estado        = (int)DenunciaEstado.EnRevision;
            if (DenunciasService.Denuncie(denuncia.IdPropuesta))
            {
                ModelState.AddModelError("", "Ya existe una denuncia de esta persona para esta propuesta");
            }
            if (!ModelState.IsValid)
            {
                var motivos = MotivoDenunciaService.GetAll().Select(m => new SelectListItem
                {
                    Text  = m.Descripcion,
                    Value = m.IdMotivoDenuncia.ToString()
                }).ToList();
                motivos = motivos.Prepend(new SelectListItem
                {
                    Value    = "0",
                    Text     = "Seleccione un motivo",
                    Disabled = true,
                    Selected = true
                }).ToList();
                var viewModel = new DenunciaViewModel
                {
                    IdPropuesta     = denuncia.IdPropuesta,
                    MotivoDenuncia  = motivos,
                    NombrePropuesta = PropuestaService.GetById(denuncia.IdPropuesta).Nombre
                };
                return(View(viewModel));
            }

            DenunciasService.Crear(denuncia);
            PropuestaService.Instance.PonerPropuestaEnRevision(denuncia.IdPropuesta);
            return(RedirectToAction("Inicio", "Inicio"));
        }