Пример #1
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"));
     }
 }
Пример #2
0
        public void BorrarEntradaPendienteDeModerarcion(int p_entrada)
        {
            try
            {
                SessionInitializeTransaction();

                // codigo que va a atacar a la bd
                EntradaCEN    entradaCEN    = new EntradaCEN(new EntradaCAD(session));
                ComentarioCEN comentarioCEN = new ComentarioCEN(new ComentarioCAD(session));
                EntradaEN     entr          = entradaCEN.get_IEntradaCAD().ReadOIDDefault(p_entrada);

                for (int i = 0; i < entr.Comentarios.Count; i++)
                {
                    comentarioCEN.BorrarComentario(entr.Comentarios[i].Id);
                }

                entradaCEN.BorrarEntrada(entr.Id);

                SessionCommit();
            }
            catch (Exception ex)
            {
                SessionRollBack();
                throw ex;
            }
            finally
            {
                SessionClose();
            }
        }
Пример #3
0
 static public void Destruccion()
 {
     comCEN.BorrarComentario(comid);
     muroCEN.BorrarMuro(muroid);
     entrCEN.BorrarEntrada(entrid);
     usuCEN.BorrarUsuario(us1);
     usuCEN.BorrarUsuario(us2);
     usuCEN.BorrarUsuario(us3);
     usuCEN.BorrarUsuario(us4);
     usuCEN.BorrarUsuario(us5);
 }
Пример #4
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         ComentarioCEN cen = new ComentarioCEN();
         cen.BorrarComentario(id);
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
Пример #5
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"));
            }
        }