示例#1
0
        public async Task <IActionResult> Edit(int id, [Bind("FilmTitleID,FilmTitle,FilmStory,FilmRelaseDate,FilmDuration,FilmGenereID,FilmCertificateID,FilmAdditionalInfo")] FilmTitles filmTitles)
        {
            if (id != filmTitles.FilmTitleID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(filmTitles);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!FilmTitlesExists(filmTitles.FilmTitleID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FilmCertificateID"] = new SelectList(_context.FilmCertificates, "CertificateID", "FilmCertificate", filmTitles.FilmCertificateID);
            ViewData["FilmGenereID"]      = new SelectList(_context.FilmGeneres, "GenereID", "GenreDesc", filmTitles.FilmGenereID);
            return(View(filmTitles));
        }
示例#2
0
        public async Task <IActionResult> Create([Bind("FilmTitleID,FilmTitle,FilmStory,FilmRelaseDate,FilmDuration,FilmGenereID,FilmCertificateID,FilmAdditionalInfo")] FilmTitles filmTitles)
        {
            if (ModelState.IsValid)
            {
                _context.Add(filmTitles);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FilmCertificateID"] = new SelectList(_context.FilmCertificates, "CertificateID", "FilmCertificate", filmTitles.FilmCertificateID);
            ViewData["FilmGenereID"]      = new SelectList(_context.FilmGeneres, "GenereID", "GenreDesc", filmTitles.FilmGenereID);
            return(View(filmTitles));
        }
示例#3
0
        public static void Initializate(dvdCollectionContext context)
        {
            context.Database.EnsureCreated(); // crea bd si no existe

            if (context.FilmGeneres.Any())
            {
                return; // la bd ya tiene datos
            }

            // arreglo del tipo FilmGeneres
            var FilmGeneres = new FilmGeneres[] {
                new FilmGeneres {
                    GenereDesc = "Action"
                },
                new FilmGeneres {
                    GenereDesc = "Aventure"
                },
                new FilmGeneres {
                    GenereDesc = "Animation"
                },
                new FilmGeneres {
                    GenereDesc = "Biography"
                },
                new FilmGeneres {
                    GenereDesc = "Comedy"
                },
                new FilmGeneres {
                    GenereDesc = "Crime"
                },
                new FilmGeneres {
                    GenereDesc = "Drama"
                },
                new FilmGeneres {
                    GenereDesc = "Family"
                },
                new FilmGeneres {
                    GenereDesc = "Fantasy"
                },
                new FilmGeneres {
                    GenereDesc = "History"
                }
            };

            // pasar el arreglo a la tabla de FilmGeneres en el modelo
            foreach (FilmGeneres g in FilmGeneres)
            {
                context.FilmGeneres.Add(g);
            }
            //grabar los datos en la bd fisica
            context.SaveChanges();

            // FilmCertificates
            var FilmCertificates = new FilmCertificates[] {
                new FilmCertificates {
                    FilmCertificate = "G"
                },
                new FilmCertificates {
                    FilmCertificate = "PG"
                },
                new FilmCertificates {
                    FilmCertificate = "PG-13"
                },
                new FilmCertificates {
                    FilmCertificate = "R"
                },
                new FilmCertificates {
                    FilmCertificate = "NC-17"
                }
            };

            foreach (FilmCertificates f in FilmCertificates)
            {
                context.FilmCertificates.Add(f);
            }
            context.SaveChanges();

            //actores
            var Actors = new Actors[] {
                new Actors {
                    ActorFullName = "Linda Blair", ActorNotes = "algoskdjfkjdkfjklasj;kldjf"
                },
                new Actors {
                    ActorFullName = "Scarlett Johansson", ActorNotes = "dfoskdjfkjdkfjklasj;kldjf"
                },
                new Actors {
                    ActorFullName = "Kesia ", ActorNotes = "dhsjfkasoskdjfkjdkfjklasj;kldjf"
                }
            };

            foreach (Actors a in Actors)
            {
                context.Actors.Add(a);
            }
            context.SaveChanges();

            //RoleTypes
            var RoleTypes = new RoleTypes[] {
                new RoleTypes {
                    RoleDesc = "Lead"
                },
                new RoleTypes {
                    RoleDesc = "Principal "
                },
                new RoleTypes {
                    RoleDesc = "Supportin"
                },
                new RoleTypes {
                    RoleDesc = "Featured"
                },
                new RoleTypes {
                    RoleDesc = "Extra"
                }
            };

            foreach (RoleTypes r in RoleTypes)
            {
                context.RoleTypes.Add(r);
            }
            context.SaveChanges();

            // Producers
            var Producers = new Producers[] {
                new Producers {
                    ProducerName = "Alejandro González Iñárritu", ContactEmailAddress = "*****@*****.**", WebSite = "http://alegon.com"
                },
                new Producers {
                    ProducerName = "Alfonso Cuarón", ContactEmailAddress = "*****@*****.**", WebSite = "http://cuaron.tv   "
                },
                new Producers {
                    ProducerName = "Guillermo del Toro", ContactEmailAddress = "*****@*****.**", WebSite = "http://deltoro.com"
                },
            };

            foreach (Producers p in Producers)
            {
                context.Producers.Add(p);
            }
            context.SaveChanges();
            // FilmTitles
            var FilmTitles = new FilmTitles[] {
                new FilmTitles {
                    FilmTitle         = "El laberinto del fauno",
                    FilmCertificateID = 1, FilmGenereID = 1, FilmRelaseDate = DateTime.Parse("1/1/2010"),
                    FilmDuration      = 120, FilmStory = "El fauno asusta la niña"
                }
            };

            foreach (FilmTitles t in FilmTitles)
            {
                context.FilmTitles.Add(t);
            }
            context.SaveChanges();
        }
示例#4
0
        public static void Initializate(dvdCollectionContext context)
        {
            context.Database.EnsureCreated(); // crea bd si no existe

            if (context.FilmGeneres.Any())
            {
                return; // la bd ya tiene datos
            }

            // arreglo del tipo FilmGeneres
            var FilmGeneres = new FilmGeneres[] {
                new FilmGeneres {
                    GenreDesc = "Action"
                },
                new FilmGeneres {
                    GenreDesc = "Aventure"
                },
                new FilmGeneres {
                    GenreDesc = "Animation"
                },
                new FilmGeneres {
                    GenreDesc = "Biography"
                },
                new FilmGeneres {
                    GenreDesc = "Comedy"
                },
                new FilmGeneres {
                    GenreDesc = "Crime"
                },
                new FilmGeneres {
                    GenreDesc = "Drama"
                },
                new FilmGeneres {
                    GenreDesc = "Family"
                },
                new FilmGeneres {
                    GenreDesc = "Fantasy"
                },
                new FilmGeneres {
                    GenreDesc = "History"
                }
            };

            // pasar el arreglo a la tabla de FilmGeneres en el modelo
            foreach (FilmGeneres g in FilmGeneres)
            {
                context.FilmGeneres.Add(g);
            }
            //grabar los datos en la bd fisica
            context.SaveChanges();

            // FilmCertificates
            var FilmCertificates = new FilmCertificates[] {
                new FilmCertificates {
                    FilmCertificate = "G"
                },
                new FilmCertificates {
                    FilmCertificate = "PG"
                },
                new FilmCertificates {
                    FilmCertificate = "PG-13"
                },
                new FilmCertificates {
                    FilmCertificate = "R"
                },
                new FilmCertificates {
                    FilmCertificate = "NC-17"
                }
            };

            foreach (FilmCertificates f in FilmCertificates)
            {
                context.FilmCertificates.Add(f);
            }
            context.SaveChanges();

            // Actors
            var Actors = new Actors[] {
                new Actors {
                    ActorFullName = "Linda Blair", ActorNotes = "Es una actriz de cine estadounidense internacionalmente conocida por su papel de Regan MacNeil, la niña poseída por un demonio, en la película de terror"
                },
                new Actors {
                    ActorFullName = "Scarlett Johansson", ActorNotes = "es una actriz de cine, cantante y modelo estadounidense que alcanzó la fama con su papel en la película The Horse Whisperer"
                },
                new Actors {
                    ActorFullName = "Keshia Knight Pulliam", ActorNotes = "es una actriz estadounidense. Es conocida por su papel de infancia como Rudy Huxtabl"
                }
            };

            foreach (Actors a in Actors)
            {
                context.Actors.Add(a);
            }
            context.SaveChanges();

            // RoleTypes
            var RoleTypes = new RoleTypes[] {
                new RoleTypes {
                    RoleDesc = "Lead"
                },
                new RoleTypes {
                    RoleDesc = "Principal"
                },
                new RoleTypes {
                    RoleDesc = "Supporting"
                },
                new RoleTypes {
                    RoleDesc = "Featured"
                },
                new RoleTypes {
                    RoleDesc = "Extra"
                },
            };

            foreach (RoleTypes r in RoleTypes)
            {
                context.RoleTypes.Add(r);
            }
            context.SaveChanges();

            // Producers
            var Producers = new Producers[] {
                new Producers {
                    ProducerName = "Alejandro González Iñárritu", ContactEmailAddress = "*****@*****.**", WebSite = "http://alegon.com"
                },
                new Producers {
                    ProducerName = "Alfonso Cuarón", ContactEmailAddress = "*****@*****.**", WebSite = "http://cuaron.tv   "
                },
                new Producers {
                    ProducerName = "Guillermo del Toro", ContactEmailAddress = "*****@*****.**", WebSite = "http://deltoro.com"
                },
            };

            foreach (Producers p in Producers)
            {
                context.Producers.Add(p);
            }
            context.SaveChanges();

            // FilmTitles
            var FilmTitles = new FilmTitles[] {
                new FilmTitles {
                    FilmTitle         = "El laberinto del fauno",
                    FilmCertificateID = 1, FilmGenereID = 1, FilmRelaseDate = DateTime.Parse("1/1/2010"),
                    FilmDuration      = 120, FilmStory = "El fauno asusta la niña"
                }
            };

            foreach (FilmTitles t in FilmTitles)
            {
                context.FilmTitles.Add(t);
            }
            context.SaveChanges();
        }
示例#5
0
        public static void Initializate(dvdCollectionContext context)
        {
            context.Database.EnsureCreated(); //c rea un Bd si no exite

            if (context.FilmGeneres.Any())
            {
                return; //la base de dats ya tiene datos
            }
            // arreglo de tipo film generes
            var FilmGeneres = new FilmGeneres[] {
                new FilmGeneres {
                    GenreDesc = "Action"
                },
                new FilmGeneres {
                    GenreDesc = "Aventure"
                },
                new FilmGeneres {
                    GenreDesc = "Animation"
                },
                new FilmGeneres {
                    GenreDesc = "biograpy"
                },
                new FilmGeneres {
                    GenreDesc = "Comedy"
                },
                new FilmGeneres {
                    GenreDesc = "Crime"
                },
                new FilmGeneres {
                    GenreDesc = "Drama"
                },
                new FilmGeneres {
                    GenreDesc = "Family"
                },
                new FilmGeneres {
                    GenreDesc = "Fantasy"
                },
                new FilmGeneres {
                    GenreDesc = "History"
                }
            };

            foreach (FilmGeneres g in FilmGeneres)
            {
                context.FilmGeneres.Add(g);
            }
            context.SaveChanges();

            //FilmCertificates
            var FilmCertificates = new FilmCertificates[] {
                new FilmCertificates {
                    FilmCertificate = "G"
                },
                new FilmCertificates {
                    FilmCertificate = "PG"
                },
                new FilmCertificates {
                    FilmCertificate = "PG-13"
                },
                new FilmCertificates {
                    FilmCertificate = "R"
                },
                new FilmCertificates {
                    FilmCertificate = "NC-17"
                }
            };

            foreach (FilmCertificates f in FilmCertificates)
            {
                context.FilmCertificates.Add(f);
            }
            context.SaveChanges();

            //actors
            var Actors = new Actors[] {
                new Actors {
                    ActorFullName = "Linda Blair", ActorNotes = "From the age of five, Linda Blair had to get used to the spotlight, first as a child model and then as an actress, when out of 600 applicants she was picked for the role of Regan, the possessed child, in El exorcista (1973)."
                },
                new Actors {
                    ActorFullName = "Scarlett Johansson", ActorNotes = "Scarlett Ingrid Johansson (Nueva York, 22 de noviembre de 1984)4​ es una actriz de cine, cantante y modelo estadounidense que alcanzó la fama con su papel en la película The Horse Whisperer (1998) y posteriormente obtuvo la aclamación por parte de los críticos de cine debido a su participación en Ghost World"
                },
                new Actors {
                    ActorFullName = "Keshia Knight Pulliam", ActorNotes = "eshia Knight Pulliam es una actriz estadounidense. Es conocida por su papel de infancia como Rudy Huxtable, el hijo más joven de Cliff y Clair Huxtable con solo 5 a 13 años, en la comedia de la NBC The Cosby Show y como Miranda Lucas-Payne en la comedia dramática de TBS Tyler Perry's House de Payne"
                }
            };

            foreach (Actors a in Actors)
            {
                context.Actors.Add(a);
            }
            context.SaveChanges();
            //RoleTypes

            var RolesTypes = new RolesTypes[] {
                new RolesTypes {
                    RolDesc = "Lead"
                },
                new RolesTypes {
                    RolDesc = "Principal"
                },
                new RolesTypes {
                    RolDesc = "Supporting"
                },
                new RolesTypes {
                    RolDesc = "Fetured"
                },
                new RolesTypes {
                    RolDesc = "Extra"
                }
            };

            foreach (RolesTypes r in RolesTypes)
            {
                context.RoleTypes.Add(r);
            }
            context.SaveChanges();
            //Producers
            var Producers = new Producers[] {
                new Producers {
                    ProducerName = "Alejandro González Iñárritu", ContactEmailAddress = "*****@*****.**", WebSite = "iñarittu.com"
                },
                new Producers {
                    ProducerName = "Alfonso Cuarón", ContactEmailAddress = "*****@*****.**", WebSite = "Cuaron.com"
                },
                new Producers {
                    ProducerName = "Guillermo del Toro Gómez", ContactEmailAddress = "*****@*****.**", WebSite = "gullermito.com"
                }
            };

            foreach (Producers pr in Producers)
            {
                context.Producers.Add(pr);
            }
            context.SaveChanges();

            //FilmTitles
            var FilmTitles = new FilmTitles[] {
                new FilmTitles {
                    FilmTitle         = "El laberinto del faulno",
                    FilmCertificateID = 1, FilmGenereID = 1, FilmRelaseDate = DateTime.Parse("1/1/2018"),
                    FilmDuration      = 120, FilmStory = "El fauno asusta la niña"
                }
            };

            foreach (FilmTitles t in FilmTitles)
            {
                context.FilmTitles.Add(t);
            }
            context.SaveChanges();
        }