Example #1
0
        public tb_visor_video_Info get_info(string Cod_video)
        {
            try
            {
                tb_visor_video_Info info = new tb_visor_video_Info();
                using (Entities_general Context = new Entities_general())
                {
                    tb_visor_video Entity = Context.tb_visor_video.FirstOrDefault(q => q.Cod_video == Cod_video);
                    if (Entity == null)
                    {
                        return(null);
                    }

                    info = new tb_visor_video_Info
                    {
                        Cod_video    = Entity.Cod_video,
                        Nombre_video = Entity.Nombre_video
                    };
                }
                return(info);
            }
            catch (Exception)
            {
                throw;
            }
        }
Example #2
0
        public ActionResult Nuevo(tb_visor_video_Info model)
        {
            if (bus_pais.si_existe(model.Cod_video))
            {
                ViewBag.mensaje = "El código ya se encuentra registrado";
                return(View(model));
            }
            if (!bus_pais.guardarDB(model))
            {
                return(View(model));
            }
            model.video = tb_visor_video_video.video;
            string patch = Path.Combine(Server.MapPath("~/Content"), model.Cod_video);

            if (System.IO.File.Exists(patch + ".mp4"))
            {
                System.IO.File.Delete(patch + ".mp4");
            }
            using (System.IO.StreamWriter file = new System.IO.StreamWriter(patch + ".mp4", true))
            {
                file.WriteLine(model.video);
                file.Close();
            }
            return(RedirectToAction("Index"));
        }
Example #3
0
 public ActionResult Modificar(tb_visor_video_Info model)
 {
     if (!bus_pais.modificarDB(model))
     {
         return(View(model));
     }
     return(RedirectToAction("Index"));
 }
Example #4
0
        public ActionResult Modificar(string Cod_video)
        {
            tb_visor_video_Info model = bus_pais.get_info(Cod_video);

            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            return(View(model));
        }
Example #5
0
 public bool anularDB(tb_visor_video_Info info)
 {
     try
     {
         return(odata.anularDB(info));
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #6
0
        public ActionResult ReproducirVideo(string Cod_video)
        {
            tb_visor_video_Info model = new tb_visor_video_Info();

            model = bus_pais.get_info(Cod_video);
            if (model == null)
            {
                return(RedirectToAction("Index"));
            }
            ViewBag.Cod_video = model.Cod_video + ".mp4";

            return(View(model));
        }
Example #7
0
 public bool anularDB(tb_visor_video_Info info)
 {
     try
     {
         using (Entities_general Context = new Entities_general())
         {
             tb_visor_video Entity = Context.tb_visor_video.FirstOrDefault(q => q.Cod_video == info.Cod_video);
             if (Entity == null)
             {
                 return(false);
             }
             Entity.Estado             = false;
             Entity.IdUsuarioAnulacion = info.IdUsuarioAnulacion;
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #8
0
 public bool modificarDB(tb_visor_video_Info info)
 {
     try
     {
         using (Entities_general Context = new Entities_general())
         {
             tb_visor_video Entity = Context.tb_visor_video.FirstOrDefault(q => q.Cod_video == info.Cod_video);
             if (Entity == null)
             {
                 return(false);
             }
             Entity.Nombre_video      = info.Nombre_video;
             Entity.IdUsuarioModifica = info.IdUsuarioModifica;
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #9
0
 public bool si_existe(string Cod_video)
 {
     try
     {
         tb_visor_video_Info info = new tb_visor_video_Info();
         using (Entities_general Context = new Entities_general())
         {
             tb_visor_video Entity = Context.tb_visor_video.FirstOrDefault(q => q.Cod_video == Cod_video);
             if (Entity == null)
             {
                 return(false);
             }
             else
             {
                 return(true);
             }
         }
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #10
0
 public bool guardarDB(tb_visor_video_Info info)
 {
     try
     {
         using (Entities_general Context = new Entities_general())
         {
             tb_visor_video Entity = new tb_visor_video
             {
                 Cod_video    = info.Cod_video,
                 Nombre_video = info.Nombre_video,
                 IdUsuario    = info.IdUsuario,
                 Estado       = true
             };
             Context.tb_visor_video.Add(Entity);
             Context.SaveChanges();
         }
         return(true);
     }
     catch (Exception)
     {
         throw;
     }
 }
Example #11
0
        public ActionResult Nuevo()
        {
            tb_visor_video_Info model = new tb_visor_video_Info();

            return(View(model));
        }