Beispiel #1
0
        public ActionResult Delete(int id)
        {
            try
            {
                int id_usuario, id_PF = 0;
                id_usuario = Convert.ToInt32(Session["id_usuario"]);

                using (BD_NETLINKEntities1 bd = new BD_NETLINKEntities1())
                {
                    var lista = from prg2 in bd.PeliculasPorVer
                                where prg2.Id_multimedia == id &&
                                prg2.Id_usuario == id_usuario
                                select prg2;

                    if (lista.Count() > 0)
                    {
                        PeliculasPorVer obj = lista.First();
                        id_PF = Convert.ToInt32(obj.Id_peliculaPorVer);
                    }
                }

                using (var data = new BD_NETLINKEntities1())
                {
                    var oMovie = data.PeliculasPorVer.Find(id_PF);
                    data.PeliculasPorVer.Remove(oMovie);
                    data.SaveChanges();
                }
                return(Content("1"));
            }
            catch
            {
                return(Content("0"));
            }
        }
Beispiel #2
0
        public int Compare(int id_multimedia)
        {
            try
            {
                using (BD_NETLINKEntities1 bd = new BD_NETLINKEntities1())
                {
                    var lista = from prg2 in bd.PeliculasPorVer
                                where prg2.Id_multimedia == id_multimedia &&
                                prg2.Id_usuario == Convert.ToInt32(Session["id_usuario"])
                                select prg2;

                    if (lista.Count() > 0)
                    {
                        PeliculasPorVer obj = lista.First();
                        return(Convert.ToInt32(obj.Id_multimedia));
                    }
                    else
                    {
                        return(0);
                    }
                }
            }
            catch (Exception x)
            {
                return(0);
            }
        }
Beispiel #3
0
        public ActionResult ShowMovieInsert(int?idPelicula)
        {
            try
            {
                int id_usuario = 000;
                id_usuario = Convert.ToInt32(Session["id_usuario"]);


                using (BD_NETLINKEntities1 bd = new BD_NETLINKEntities1())
                {
                    var lista = from prg2 in bd.PeliculasPorVer
                                where prg2.Id_usuario == id_usuario &&
                                prg2.Id_multimedia == idPelicula
                                select prg2;

                    if (lista.Count() > 0)
                    {
                        return(Content("1"));
                    }
                }


                using (var data = new BD_NETLINKEntities1())
                {
                    PeliculasPorVer objSM = new PeliculasPorVer();
                    objSM.Id_multimedia = idPelicula;
                    objSM.Id_usuario    = Convert.ToInt32(Session["id_usuario"]);
                    data.PeliculasPorVer.Add(objSM);
                    data.SaveChanges();
                    return(Content("True"));
                }
            }
            catch (Exception x)
            {
                return(Content("Se genero un error! " + x.Message));
            }
        }