Пример #1
0
        public ActionResult Edit(int id, ComentarioModelo mod)
        {
            String        tip  = RouteData.Values["var"].ToString();
            int           tipo = Int32.Parse(tip);
            ComentarioCEN cen  = new ComentarioCEN();
            ComentarioEN  en   = cen.ReadOID(id);

            if (tipo == 2)
            {
                en.Tipocom = TipoComentarioEnum.Evento;
            }
            else
            {
                en.Tipocom = TipoComentarioEnum.Foto;
            }
            cen.EditarComentario(id, "", mod.texto, en.Likes, en.Tipocom);
            if (en.Tipocom == TipoComentarioEnum.Foto)
            {
                return(RedirectToAction("Details", "Foto", new { id = en.Foto.Id }));
            }
            else if (en.Tipocom == TipoComentarioEnum.Evento)
            {
                return(RedirectToAction("Details", "Evento", new { id = en.Evento.Id }));
            }
            return(View());
        }
Пример #2
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         String        tip  = RouteData.Values["var"].ToString();
         int           tipo = Int32.Parse(tip);
         ComentarioCEN cen  = new ComentarioCEN();
         ComentarioEN  en   = cen.ReadOID(id);
         int           refe = 0;
         try{
             refe = en.Evento.Id;
         }
         catch {
             refe = en.Foto.Id;
         }
         cen.BorrarComentario(id);
         if (tipo == 2)
         {
             return(RedirectToAction("Details", "Evento", new { id = refe }));
         }
         else
         {
             return(RedirectToAction("Details", "Foto", new { id = refe }));
         }
     }
     catch
     {
         ComentarioCEN cen = new ComentarioCEN();
         cen.BorrarComentario(id);
         return(RedirectToAction("Index"));
     }
 }
Пример #3
0
        public ActionResult Create(ReporteModelo repMod)
        {
            ReporteCP     repCP = new ReporteCP();
            ComentarioCEN cen   = new ComentarioCEN();
            EventoCEN     cen2  = new EventoCEN();

            var userName = System.Web.HttpContext.Current.User.Identity.Name;

            repCP.NuevoReporte(repMod.texto, repMod.motivo, userName, repMod.id, repMod.tipo);
            if (repMod.tipo == TipoReporteEnum.foto)
            {
                return(RedirectToAction("Details", "Foto", new { id = repMod.id }));
            }
            if (repMod.tipo == TipoReporteEnum.evento)
            {
                return(RedirectToAction("Details", "Evento", new { id = repMod.id }));
            }
            if (repMod.tipo == TipoReporteEnum.comentario)
            {
                ComentarioEN en = cen.ReadOID(repMod.id);
                if (cen2.ReadOID(en.Evento.Id) != null)
                {
                    return(RedirectToAction("Details", "Evento", new { id = en.Evento.Id }));
                }
                else
                {
                    return(RedirectToAction("Details", "Foto", new { id = en.Foto.Id }));
                }
            }
            return(RedirectToAction("Index"));
        }
Пример #4
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here

                SessionInitialize();
                ComentarioCAD   comentarioCAD = new ComentarioCAD(session);
                ComentarioCEN   comentarioCEN = new ComentarioCEN(comentarioCAD);
                ComentarioEN    comentarioEN  = comentarioCEN.ReadOID(id);
                ComentarioModel comentario    = ComentarioAssembler.convertENToModelUI(comentarioEN);

                VideoModel vid   = new VideoModel();
                VideoEN    vidEN = new VideoCAD(session).ReadOIDDefault(comentarioEN.Video.Id);
                vid = VideoAssembler.convertENToModelUI(vidEN);

                SessionClose();

                new ComentarioCEN().Destroy(id);



                return(RedirectToRoute(new
                {
                    controller = "Video",
                    action = "Details",
                    id = vid.Id,
                }));
            }
            catch
            {
                return(View());
            }
        }
Пример #5
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
                SessionInitialize();
                ComentarioCAD cad = new ComentarioCAD(session);

                ComentarioCEN cen = new ComentarioCEN(cad);


                ComentarioEN en = new ComentarioEN();
                en = cen.ReadOID(id);


                AssemblerComentario ass = new AssemblerComentario();

                Comentario sol  = ass.ConvertENToModelUI(en);
                string     tipo = null;


                ProductoCAD cadp = new ProductoCAD(session);
                ProductoCEN cenp = new ProductoCEN(cadp);
                ProductoEN  enp  = cenp.ReadOID(sol.idsup);


                EventoCAD cade = new EventoCAD(session);
                EventoCEN cene = new EventoCEN(cade);
                EventoEN  ene  = cene.ReadOID(sol.idsup);



                if (ene != null)
                {
                    tipo = "Evento";
                }
                else if (enp != null)
                {
                    tipo = "Producto";
                }
                else
                {
                    tipo = sol.tipo;
                }

                SessionClose();
                ComentarioCEN cenn = new ComentarioCEN();


                cenn.Destroy(id);



                return(RedirectToAction("Details", tipo, new { id = sol.idsup }));
            }
            catch
            {
                return(View());
            }
        }
Пример #6
0
        public ActionResult Edit(int id, Comentario collection)
        {
            try
            {
                // TODO: Add update logic here

                ComentarioCEN cen = new ComentarioCEN();



                cen.Modify(collection.id, collection.comentario, collection.autor, new DateTime(collection.fecha.Year, collection.fecha.Month, collection.fecha.Day));
                ComentarioEN en = new ComentarioEN();
                en = cen.ReadOID(id);


                AssemblerComentario ass = new AssemblerComentario();
                Comentario          sol = ass.ConvertENToModelUI(en);



                return(RedirectToAction("Details", sol.tipo, new { id = sol.idsup }));
            }
            catch
            {
                return(View());
            }
        }
Пример #7
0
        public ActionResult Edit(int id, ComentarioModel com)
        {
            ComentarioCEN comCEN = new ComentarioCEN();
            ComentarioEN  comEN  = comCEN.ReadOID(id);

            comCEN.EditarComentario(id, " ", com.texto, com.likes);

            return(RedirectToAction("Details", "Evento", new { id = comEN.Evento.Id }));

            //return View();
        }
Пример #8
0
        // GET: Articulo/Delete/5
        public ActionResult Delete(int id)
        {
            ComentarioCEN cen = new ComentarioCEN();

            ComentarioEN en = new ComentarioEN();

            en = cen.ReadOID(id);
            AssemblerComentario ass = new AssemblerComentario();
            Comentario          sol = ass.ConvertENToModelUI(en);


            return(View(sol));
        }
Пример #9
0
        public ActionResult Edit(int id, ComentarioModelo mod)
        {
            try
            {
                ComentarioCEN cen = new ComentarioCEN();
                ComentarioEN  en  = cen.ReadOID(id);
                cen.EditarComentario(id, mod.titulo, mod.texto, en.Likes, mod.tipo);

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }
Пример #10
0
        // GET: Comentario/Delete/5
        public ActionResult Delete(int id)
        {
            int idCategoria = -1;

            SessionInitialize();
            ComentarioCAD       comCAD = new ComentarioCAD(session);
            ComentarioCEN       cen    = new ComentarioCEN(comCAD);
            ComentarioEN        comEN  = cen.ReadOID(id);
            ComentarioViewModel art    = new ComentarioAssembler().ConvertEnToModelUI(comEN);

            SessionClose();

            new ComentarioCEN().Destroy(id);

            return(RedirectToAction("Index"));
        }
Пример #11
0
        public ActionResult Delete(int id, FormCollection collection)
        {
            try
            {
                // TODO: Add delete logic here
                ComentarioCEN comenCEN = new ComentarioCEN();
                ComentarioEN  comenEN  = comenCEN.ReadOID(id);
                comenCEN.BorrarComentario(id);

                return(RedirectToAction("Details", "Evento", new { id = comenEN.Evento.Id }));
            }
            catch
            {
                ComentarioCEN coCEN = new ComentarioCEN();
                coCEN.BorrarComentario(id);
                return(RedirectToAction("Index"));
            }
        }