From 918bd58849fd2b7f9904cce942fd9160d110e61d Mon Sep 17 00:00:00 2001 From: Waylate1 Date: Fri, 5 Dec 2025 21:12:02 -0800 Subject: [PATCH] Added Movies and Pictures --- CCMovieDatabase/CCMovieDatabase.csproj.user | 2 +- .../Controllers/AedonController.cs | 170 ++++++ CCMovieDatabase/Data/MovieContext.cs | 12 +- .../20251205091324_MoreSeedData.Designer.cs | 537 +++++++++++++++++ .../Migrations/20251205091324_MoreSeedData.cs | 75 +++ ...1205112728_AddedMoreSeedImages.Designer.cs | 542 ++++++++++++++++++ .../20251205112728_AddedMoreSeedImages.cs | 88 +++ .../Migrations/MovieContextModelSnapshot.cs | 50 ++ CCMovieDatabase/Views/Aedon/Create.cshtml | 52 ++ CCMovieDatabase/Views/Aedon/Delete.cshtml | 51 ++ CCMovieDatabase/Views/Aedon/Details.cshtml | 48 ++ CCMovieDatabase/Views/Aedon/Edit.cshtml | 54 ++ CCMovieDatabase/Views/Aedon/Index.cshtml | 66 +++ CCMovieDatabase/Views/Shared/_Layout.cshtml | 3 + 14 files changed, 1748 insertions(+), 2 deletions(-) create mode 100644 CCMovieDatabase/Controllers/AedonController.cs create mode 100644 CCMovieDatabase/Migrations/20251205091324_MoreSeedData.Designer.cs create mode 100644 CCMovieDatabase/Migrations/20251205091324_MoreSeedData.cs create mode 100644 CCMovieDatabase/Migrations/20251205112728_AddedMoreSeedImages.Designer.cs create mode 100644 CCMovieDatabase/Migrations/20251205112728_AddedMoreSeedImages.cs create mode 100644 CCMovieDatabase/Views/Aedon/Create.cshtml create mode 100644 CCMovieDatabase/Views/Aedon/Delete.cshtml create mode 100644 CCMovieDatabase/Views/Aedon/Details.cshtml create mode 100644 CCMovieDatabase/Views/Aedon/Edit.cshtml create mode 100644 CCMovieDatabase/Views/Aedon/Index.cshtml diff --git a/CCMovieDatabase/CCMovieDatabase.csproj.user b/CCMovieDatabase/CCMovieDatabase.csproj.user index ec209e7..0d865ae 100644 --- a/CCMovieDatabase/CCMovieDatabase.csproj.user +++ b/CCMovieDatabase/CCMovieDatabase.csproj.user @@ -8,7 +8,7 @@ 650 True False - False + True CCMovieDatabase.Data.MovieContext False diff --git a/CCMovieDatabase/Controllers/AedonController.cs b/CCMovieDatabase/Controllers/AedonController.cs new file mode 100644 index 0000000..5ff8d38 --- /dev/null +++ b/CCMovieDatabase/Controllers/AedonController.cs @@ -0,0 +1,170 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.EntityFrameworkCore; +using CCMovieDatabase.Data; +using CCMovieDatabase.Models; +//I'm not sure if i did this correctly however this is my attempt and hopefully i didnt mess up too badly + +namespace CCMovieDatabase.Controllers +{ + + public class AedonController : Controller + { + private readonly MovieContext _context; + + public AedonController(MovieContext context) + { + _context = context; + } + + // GET: Aedon + public async Task Index() + { + //exclude shrek 1 and shrek 2 + var movieContext = _context.Movie.Include(m => m.Rating) + .Where(m => m.Title != "Shrek") + .Where(m => m.Title != "Shrek 2"); + return View(await movieContext.ToListAsync()); + } + + // GET: Aedon/Details/5 + public async Task Details(int? id) + { + if (id == null) + { + return NotFound(); + } + + var movie = await _context.Movie + .Include(m => m.Rating) + .FirstOrDefaultAsync(m => m.Id == id); + if (movie == null) + { + return NotFound(); + } + + return View(movie); + } + + // GET: Aedon/Create + public IActionResult Create() + { + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId"); + return View(); + } + + // POST: Aedon/Create + // To protect from overposting attacks, enable the specific properties you want to bind to. + // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598. + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Create([Bind("Id,Title,Description,ReleaseDate,RatingId,ThumbnailURL")] Movie movie) + { + if (ModelState.IsValid) + { + + _context.Add(movie); + await _context.SaveChangesAsync(); + return RedirectToAction(nameof(Index)); + } + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId", movie.RatingId); + return View(movie); + } + + // GET: Aedon/Edit/5 + public async Task Edit(int? id) + { + if (id == null) + { + return NotFound(); + } + + var movie = await _context.Movie.FindAsync(id); + if (movie == null) + { + return NotFound(); + } + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId", movie.RatingId); + return View(movie); + } + + // POST: Aedon/Edit/5 + // To protect from overposting attacks, enable the specific properties you want to bind to. + // For more details, see http://go.microsoft.com/fwlink/?LinkId=317598. + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Edit(int id, [Bind("Id,Title,Description,ReleaseDate,RatingId,ThumbnailURL")] Movie movie) + { + if (id != movie.Id) + { + return NotFound(); + } + + if (ModelState.IsValid) + { + try + { + _context.Update(movie); + await _context.SaveChangesAsync(); + } + catch (DbUpdateConcurrencyException) + { + if (!MovieExists(movie.Id)) + { + return NotFound(); + } + else + { + throw; + } + } + return RedirectToAction(nameof(Index)); + } + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId", movie.RatingId); + return View(movie); + } + + // GET: Aedon/Delete/5 + public async Task Delete(int? id) + { + if (id == null) + { + return NotFound(); + } + + var movie = await _context.Movie + .Include(m => m.Rating) + .FirstOrDefaultAsync(m => m.Id == id); + if (movie == null) + { + return NotFound(); + } + + return View(movie); + } + + // POST: Aedon/Delete/5 + [HttpPost, ActionName("Delete")] + [ValidateAntiForgeryToken] + public async Task DeleteConfirmed(int id) + { + var movie = await _context.Movie.FindAsync(id); + if (movie != null) + { + _context.Movie.Remove(movie); + } + + await _context.SaveChangesAsync(); + return RedirectToAction(nameof(Index)); + } + + private bool MovieExists(int id) + { + return _context.Movie.Any(e => e.Id == id); + } + } +} diff --git a/CCMovieDatabase/Data/MovieContext.cs b/CCMovieDatabase/Data/MovieContext.cs index 1d9cab4..3e7d85b 100644 --- a/CCMovieDatabase/Data/MovieContext.cs +++ b/CCMovieDatabase/Data/MovieContext.cs @@ -29,11 +29,13 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); + var ratings = new List { new Rating { RatingId = 1, Name = "PG-13" }, new Rating { RatingId = 2, Name = "R" }, - new Rating { RatingId = 3, Name = "G" } + new Rating { RatingId = 3, Name = "G" }, + new Rating { RatingId = 4, Name = "PG"} }; modelBuilder.Entity().HasData(ratings); @@ -42,6 +44,14 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) { new Movie { Id = 1, Title = "Shrek", ReleaseDate = new DateOnly(2001, 04, 26), Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", RatingId = 1, ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTG_q0A0cypAsXxYlgs5J_554BrcnjeeKExlQE3ZaZUuPYv0fUd" }, new Movie { Id = 2, Title = "Shrek 2", ReleaseDate = new DateOnly(2002, 04, 26), Description = "Shrek is back baby!", RatingId = 1, ThumbnailURL = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTPx7lW6h0G1O9-npEnVPL07fT74Tp6SFl0i47nxfypyVBcQFdS" }, + + //Aedon seed data + + new Movie { Id = 3, Title = "Army of Darkness", ReleaseDate = new DateOnly(1993, 02, 19), Description = "When Ash Williams is accidentally transported to 1300 A.D., he must retrieve the Necronomicon and battle an army of the dead in order to return home.", RatingId = 2, ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.impawards.com%2F1993%2Fposters%2Farmy_of_darkness_ver3.jpg&f=1&nofb=1&ipt=0f5ba9f7dec46adcdb32748f094b542e4b5c8eff313c6811ef1bea9fde96af7d" }, + new Movie { Id = 4, Title = "The Truman Show", ReleaseDate = new DateOnly(1998, 06, 05), Description = "An insurance salesman begins to suspect that his whole life is actually some sort of reality TV show.", RatingId = 4, ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fpostertok.com%2Fwp-content%2Fuploads%2F2024%2F02%2F5337.webp&f=1&nofb=1&ipt=0e1573f1b1d07b5daa12a781e53f49b27c130790c4d2dcde54916cc0eff9f901" }, + new Movie { Id = 5, Title = "The Cable Guy", ReleaseDate = new DateOnly(1996, 06, 14), Description = "A designer makes a grievous mistake when he rejects the friendship of a borderline cable guy.", RatingId = 1, ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fc8.alamy.com%2Fcomp%2FBKG4ED%2Fthe-cable-guy-1996-poster-BKG4ED.jpg&f=1&nofb=1&ipt=04d76ad2b1e8ab66bd02da1ce264a9d679f0f2cad012d7c99c0ac192572af20b" }, + new Movie { Id = 6, Title = "Spider-Man", ReleaseDate = new DateOnly(2002, 05, 03), Description = "After being bitten by a genetically-modified spider, a shy teenager gains spider-like abilities that he uses to fight injustice as a masked superhero and face a vengeful enemy.", RatingId = 1, ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Famc-theatres-res.cloudinary.com%2Fv1579117618%2Famc-cdn%2Fproduction%2F2%2Fmovies%2F3500%2F3499%2FPoster%2Fp_800x1200_Spider-Man_En_0802517.jpg&f=1&nofb=1&ipt=a5788d911cca9535bbb702afd5665df889150246b214e4f0394fc6f0a1e6f798" }, + new Movie { Id = 7, Title = "The Nightmare Before Christmas", ReleaseDate = new DateOnly(1993, 10, 29), Description = "Jack Skellington, king of Halloween Town, discovers Christmas Town, but his attempts to bring Christmas to his home causes confusion.", RatingId = 4, ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.impawards.com%2F1993%2Fposters%2Fnightmare_before_christmas_ver1.jpg&f=1&nofb=1&ipt=a3fc758eba9bddd233e7d4e35b4511f5d2f2482e2d85d1589232c9d6a4c4efe6" }, }; modelBuilder.Entity().HasData(movies); diff --git a/CCMovieDatabase/Migrations/20251205091324_MoreSeedData.Designer.cs b/CCMovieDatabase/Migrations/20251205091324_MoreSeedData.Designer.cs new file mode 100644 index 0000000..451b2ac --- /dev/null +++ b/CCMovieDatabase/Migrations/20251205091324_MoreSeedData.Designer.cs @@ -0,0 +1,537 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251205091324_MoreSeedData")] + partial class MoreSeedData + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.Property("ActingCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ActingCreditId")); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("ActingCreditId"); + + b.HasIndex("CharacterId"); + + b.HasIndex("PersonId"); + + b.ToTable("ActingCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Article", b => + { + b.Property("ArticleId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ArticleId")); + + b.Property("Author") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("IsFeatured") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ArticleId"); + + b.ToTable("Articles"); + + b.HasData( + new + { + ArticleId = 1, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "Welcome to CCMovieDatabase" + }, + new + { + ArticleId = 2, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world2", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "More Movies Added" + }, + new + { + ArticleId = 3, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world3", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "For the love of movies" + }, + new + { + ArticleId = 4, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world4", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "I wrote this" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Category", b => + { + b.Property("CategoryId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CategoryId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CategoryId"); + + b.ToTable("Categories"); + + b.HasData( + new + { + CategoryId = 1, + Name = "Computer Accessories" + }, + new + { + CategoryId = 2, + Name = "Graphics Cards" + }, + new + { + CategoryId = 3, + Name = "Monitors" + }, + new + { + CategoryId = 4, + Name = "Hard Drives" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.Property("CharacterId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CharacterId")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CharacterId"); + + b.HasIndex("MovieId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.Property("CrewCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CrewCreditId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("CrewCreditId"); + + b.HasIndex("MovieId"); + + b.HasIndex("PersonId"); + + b.ToTable("CrewCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("ThumbnailURL") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTG_q0A0cypAsXxYlgs5J_554BrcnjeeKExlQE3ZaZUuPYv0fUd", + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + ThumbnailURL = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTPx7lW6h0G1O9-npEnVPL07fT74Tp6SFl0i47nxfypyVBcQFdS", + Title = "Shrek 2" + }, + new + { + Id = 3, + Description = "When Ash Williams is accidentally transported to 1300 A.D., he must retrieve the Necronomicon and battle an army of the dead in order to return home.", + RatingId = 2, + ReleaseDate = new DateOnly(1993, 2, 19), + Title = "Army of Darkness" + }, + new + { + Id = 4, + Description = "An insurance salesman begins to suspect that his whole life is actually some sort of reality TV show.", + RatingId = 4, + ReleaseDate = new DateOnly(1998, 6, 5), + Title = "The Truman Show" + }, + new + { + Id = 5, + Description = "A designer makes a grievous mistake when he rejects the friendship of a borderline cable guy.", + RatingId = 1, + ReleaseDate = new DateOnly(1996, 6, 14), + Title = "The Cable Guy" + }, + new + { + Id = 6, + Description = "After being bitten by a genetically-modified spider, a shy teenager gains spider-like abilities that he uses to fight injustice as a masked superhero and face a vengeful enemy.", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 5, 3), + Title = "Spider-Man" + }, + new + { + Id = 7, + Description = "Jack Skellington, king of Halloween Town, discovers Christmas Town, but his attempts to bring Christmas to his home causes confusion.", + RatingId = 4, + ReleaseDate = new DateOnly(1993, 10, 29), + Title = "The Nightmare Before Christmas" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Property("PersonId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("PersonId")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("PersonId"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Product", b => + { + b.Property("ProductId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ProductId")); + + b.Property("CategoryId") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ProductId"); + + b.HasIndex("CategoryId"); + + b.ToTable("Products"); + + b.HasData( + new + { + ProductId = 1, + CategoryId = 1, + Description = "A simple mass produced keyboard", + Name = "Dell Keyboard" + }, + new + { + ProductId = 2, + CategoryId = 2, + Description = "A very expensive video card", + Name = "RTX 5090" + }, + new + { + ProductId = 3, + CategoryId = 3, + Description = "An enterprise widescreen monitor", + Name = "Dell Widescreen Monitor" + }, + new + { + ProductId = 4, + CategoryId = 4, + Description = "Western Digital Black Edition SSD", + Name = "WD Black Edition SSD" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }, + new + { + RatingId = 3, + Name = "G" + }, + new + { + RatingId = 4, + Name = "PG" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("ActingCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany("Characters") + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany() + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("CrewCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Product", b => + { + b.HasOne("CCMovieDatabase.Models.Category", "Category") + .WithMany("Products") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Category", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Navigation("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Navigation("ActingCredits"); + + b.Navigation("CrewCredits"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251205091324_MoreSeedData.cs b/CCMovieDatabase/Migrations/20251205091324_MoreSeedData.cs new file mode 100644 index 0000000..7da5748 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251205091324_MoreSeedData.cs @@ -0,0 +1,75 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class MoreSeedData : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "Movie", + columns: new[] { "Id", "Description", "RatingId", "ReleaseDate", "ThumbnailURL", "Title" }, + values: new object[,] + { + { 3, "When Ash Williams is accidentally transported to 1300 A.D., he must retrieve the Necronomicon and battle an army of the dead in order to return home.", 2, new DateOnly(1993, 2, 19), null, "Army of Darkness" }, + { 5, "A designer makes a grievous mistake when he rejects the friendship of a borderline cable guy.", 1, new DateOnly(1996, 6, 14), null, "The Cable Guy" }, + { 6, "After being bitten by a genetically-modified spider, a shy teenager gains spider-like abilities that he uses to fight injustice as a masked superhero and face a vengeful enemy.", 1, new DateOnly(2002, 5, 3), null, "Spider-Man" } + }); + + migrationBuilder.InsertData( + table: "Ratings", + columns: new[] { "RatingId", "Name" }, + values: new object[] { 4, "PG" }); + + migrationBuilder.InsertData( + table: "Movie", + columns: new[] { "Id", "Description", "RatingId", "ReleaseDate", "ThumbnailURL", "Title" }, + values: new object[,] + { + { 4, "An insurance salesman begins to suspect that his whole life is actually some sort of reality TV show.", 4, new DateOnly(1998, 6, 5), null, "The Truman Show" }, + { 7, "Jack Skellington, king of Halloween Town, discovers Christmas Town, but his attempts to bring Christmas to his home causes confusion.", 4, new DateOnly(1993, 10, 29), null, "The Nightmare Before Christmas" } + }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DeleteData( + table: "Movie", + keyColumn: "Id", + keyValue: 3); + + migrationBuilder.DeleteData( + table: "Movie", + keyColumn: "Id", + keyValue: 4); + + migrationBuilder.DeleteData( + table: "Movie", + keyColumn: "Id", + keyValue: 5); + + migrationBuilder.DeleteData( + table: "Movie", + keyColumn: "Id", + keyValue: 6); + + migrationBuilder.DeleteData( + table: "Movie", + keyColumn: "Id", + keyValue: 7); + + migrationBuilder.DeleteData( + table: "Ratings", + keyColumn: "RatingId", + keyValue: 4); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251205112728_AddedMoreSeedImages.Designer.cs b/CCMovieDatabase/Migrations/20251205112728_AddedMoreSeedImages.Designer.cs new file mode 100644 index 0000000..eae5b0d --- /dev/null +++ b/CCMovieDatabase/Migrations/20251205112728_AddedMoreSeedImages.Designer.cs @@ -0,0 +1,542 @@ +// +using System; +using CCMovieDatabase.Data; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + [DbContext(typeof(MovieContext))] + [Migration("20251205112728_AddedMoreSeedImages")] + partial class AddedMoreSeedImages + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "9.0.0") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.Property("ActingCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ActingCreditId")); + + b.Property("CharacterId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("ActingCreditId"); + + b.HasIndex("CharacterId"); + + b.HasIndex("PersonId"); + + b.ToTable("ActingCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Article", b => + { + b.Property("ArticleId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ArticleId")); + + b.Property("Author") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Body") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("IsFeatured") + .HasColumnType("bit"); + + b.Property("ModifiedAt") + .HasColumnType("datetime2"); + + b.Property("ShortDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ThumbnailUrl") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ArticleId"); + + b.ToTable("Articles"); + + b.HasData( + new + { + ArticleId = 1, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "Welcome to CCMovieDatabase" + }, + new + { + ArticleId = 2, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world2", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "More Movies Added" + }, + new + { + ArticleId = 3, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world3", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "For the love of movies" + }, + new + { + ArticleId = 4, + Author = "Jesse", + Body = "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.", + CreatedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + IsFeatured = true, + ModifiedAt = new DateTime(2025, 11, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + ShortDescription = "Lorem Ipsum and stuff", + Slug = "hello_world4", + ThumbnailUrl = "https://craftypixels.com/placeholder-image/300", + Title = "I wrote this" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Category", b => + { + b.Property("CategoryId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CategoryId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CategoryId"); + + b.ToTable("Categories"); + + b.HasData( + new + { + CategoryId = 1, + Name = "Computer Accessories" + }, + new + { + CategoryId = 2, + Name = "Graphics Cards" + }, + new + { + CategoryId = 3, + Name = "Monitors" + }, + new + { + CategoryId = 4, + Name = "Hard Drives" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.Property("CharacterId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CharacterId")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("CharacterId"); + + b.HasIndex("MovieId"); + + b.ToTable("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.Property("CrewCreditId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("CrewCreditId")); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("MovieId") + .HasColumnType("int"); + + b.Property("PersonId") + .HasColumnType("int"); + + b.HasKey("CrewCreditId"); + + b.HasIndex("MovieId"); + + b.HasIndex("PersonId"); + + b.ToTable("CrewCredits"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("RatingId") + .HasColumnType("int"); + + b.Property("ReleaseDate") + .HasColumnType("date"); + + b.Property("ThumbnailURL") + .HasColumnType("nvarchar(max)"); + + b.Property("Title") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("RatingId"); + + b.ToTable("Movie"); + + b.HasData( + new + { + Id = 1, + Description = "A mean lord exiles fairytale creatures to the swamp of a grumpy ogre, who must go on a quest and rescue a princess for the lord in order to get his land back.", + RatingId = 1, + ReleaseDate = new DateOnly(2001, 4, 26), + ThumbnailURL = "https://encrypted-tbn1.gstatic.com/images?q=tbn:ANd9GcTG_q0A0cypAsXxYlgs5J_554BrcnjeeKExlQE3ZaZUuPYv0fUd", + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + ThumbnailURL = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTPx7lW6h0G1O9-npEnVPL07fT74Tp6SFl0i47nxfypyVBcQFdS", + Title = "Shrek 2" + }, + new + { + Id = 3, + Description = "When Ash Williams is accidentally transported to 1300 A.D., he must retrieve the Necronomicon and battle an army of the dead in order to return home.", + RatingId = 2, + ReleaseDate = new DateOnly(1993, 2, 19), + ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.impawards.com%2F1993%2Fposters%2Farmy_of_darkness_ver3.jpg&f=1&nofb=1&ipt=0f5ba9f7dec46adcdb32748f094b542e4b5c8eff313c6811ef1bea9fde96af7d", + Title = "Army of Darkness" + }, + new + { + Id = 4, + Description = "An insurance salesman begins to suspect that his whole life is actually some sort of reality TV show.", + RatingId = 4, + ReleaseDate = new DateOnly(1998, 6, 5), + ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fpostertok.com%2Fwp-content%2Fuploads%2F2024%2F02%2F5337.webp&f=1&nofb=1&ipt=0e1573f1b1d07b5daa12a781e53f49b27c130790c4d2dcde54916cc0eff9f901", + Title = "The Truman Show" + }, + new + { + Id = 5, + Description = "A designer makes a grievous mistake when he rejects the friendship of a borderline cable guy.", + RatingId = 1, + ReleaseDate = new DateOnly(1996, 6, 14), + ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fc8.alamy.com%2Fcomp%2FBKG4ED%2Fthe-cable-guy-1996-poster-BKG4ED.jpg&f=1&nofb=1&ipt=04d76ad2b1e8ab66bd02da1ce264a9d679f0f2cad012d7c99c0ac192572af20b", + Title = "The Cable Guy" + }, + new + { + Id = 6, + Description = "After being bitten by a genetically-modified spider, a shy teenager gains spider-like abilities that he uses to fight injustice as a masked superhero and face a vengeful enemy.", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 5, 3), + ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Famc-theatres-res.cloudinary.com%2Fv1579117618%2Famc-cdn%2Fproduction%2F2%2Fmovies%2F3500%2F3499%2FPoster%2Fp_800x1200_Spider-Man_En_0802517.jpg&f=1&nofb=1&ipt=a5788d911cca9535bbb702afd5665df889150246b214e4f0394fc6f0a1e6f798", + Title = "Spider-Man" + }, + new + { + Id = 7, + Description = "Jack Skellington, king of Halloween Town, discovers Christmas Town, but his attempts to bring Christmas to his home causes confusion.", + RatingId = 4, + ReleaseDate = new DateOnly(1993, 10, 29), + ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.impawards.com%2F1993%2Fposters%2Fnightmare_before_christmas_ver1.jpg&f=1&nofb=1&ipt=a3fc758eba9bddd233e7d4e35b4511f5d2f2482e2d85d1589232c9d6a4c4efe6", + Title = "The Nightmare Before Christmas" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Property("PersonId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("PersonId")); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b.HasKey("PersonId"); + + b.ToTable("Persons"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Product", b => + { + b.Property("ProductId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("ProductId")); + + b.Property("CategoryId") + .HasColumnType("int"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ProductId"); + + b.HasIndex("CategoryId"); + + b.ToTable("Products"); + + b.HasData( + new + { + ProductId = 1, + CategoryId = 1, + Description = "A simple mass produced keyboard", + Name = "Dell Keyboard" + }, + new + { + ProductId = 2, + CategoryId = 2, + Description = "A very expensive video card", + Name = "RTX 5090" + }, + new + { + ProductId = 3, + CategoryId = 3, + Description = "An enterprise widescreen monitor", + Name = "Dell Widescreen Monitor" + }, + new + { + ProductId = 4, + CategoryId = 4, + Description = "Western Digital Black Edition SSD", + Name = "WD Black Edition SSD" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Rating", b => + { + b.Property("RatingId") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("RatingId")); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("RatingId"); + + b.ToTable("Ratings"); + + b.HasData( + new + { + RatingId = 1, + Name = "PG-13" + }, + new + { + RatingId = 2, + Name = "R" + }, + new + { + RatingId = 3, + Name = "G" + }, + new + { + RatingId = 4, + Name = "PG" + }); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.ActingCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Character", "Character") + .WithMany() + .HasForeignKey("CharacterId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("ActingCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Character"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Character", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany("Characters") + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.CrewCredit", b => + { + b.HasOne("CCMovieDatabase.Models.Movie", "Movie") + .WithMany() + .HasForeignKey("MovieId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("CCMovieDatabase.Models.Person", "Person") + .WithMany("CrewCredits") + .HasForeignKey("PersonId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Movie"); + + b.Navigation("Person"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.HasOne("CCMovieDatabase.Models.Rating", "Rating") + .WithMany() + .HasForeignKey("RatingId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Rating"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Product", b => + { + b.HasOne("CCMovieDatabase.Models.Category", "Category") + .WithMany("Products") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Category", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Movie", b => + { + b.Navigation("Characters"); + }); + + modelBuilder.Entity("CCMovieDatabase.Models.Person", b => + { + b.Navigation("ActingCredits"); + + b.Navigation("CrewCredits"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/CCMovieDatabase/Migrations/20251205112728_AddedMoreSeedImages.cs b/CCMovieDatabase/Migrations/20251205112728_AddedMoreSeedImages.cs new file mode 100644 index 0000000..aa657f9 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251205112728_AddedMoreSeedImages.cs @@ -0,0 +1,88 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class AddedMoreSeedImages : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 3, + column: "ThumbnailURL", + value: "https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.impawards.com%2F1993%2Fposters%2Farmy_of_darkness_ver3.jpg&f=1&nofb=1&ipt=0f5ba9f7dec46adcdb32748f094b542e4b5c8eff313c6811ef1bea9fde96af7d"); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 4, + column: "ThumbnailURL", + value: "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fpostertok.com%2Fwp-content%2Fuploads%2F2024%2F02%2F5337.webp&f=1&nofb=1&ipt=0e1573f1b1d07b5daa12a781e53f49b27c130790c4d2dcde54916cc0eff9f901"); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 5, + column: "ThumbnailURL", + value: "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fc8.alamy.com%2Fcomp%2FBKG4ED%2Fthe-cable-guy-1996-poster-BKG4ED.jpg&f=1&nofb=1&ipt=04d76ad2b1e8ab66bd02da1ce264a9d679f0f2cad012d7c99c0ac192572af20b"); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 6, + column: "ThumbnailURL", + value: "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Famc-theatres-res.cloudinary.com%2Fv1579117618%2Famc-cdn%2Fproduction%2F2%2Fmovies%2F3500%2F3499%2FPoster%2Fp_800x1200_Spider-Man_En_0802517.jpg&f=1&nofb=1&ipt=a5788d911cca9535bbb702afd5665df889150246b214e4f0394fc6f0a1e6f798"); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 7, + column: "ThumbnailURL", + value: "https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.impawards.com%2F1993%2Fposters%2Fnightmare_before_christmas_ver1.jpg&f=1&nofb=1&ipt=a3fc758eba9bddd233e7d4e35b4511f5d2f2482e2d85d1589232c9d6a4c4efe6"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 3, + column: "ThumbnailURL", + value: null); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 4, + column: "ThumbnailURL", + value: null); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 5, + column: "ThumbnailURL", + value: null); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 6, + column: "ThumbnailURL", + value: null); + + migrationBuilder.UpdateData( + table: "Movie", + keyColumn: "Id", + keyValue: 7, + column: "ThumbnailURL", + value: null); + } + } +} diff --git a/CCMovieDatabase/Migrations/MovieContextModelSnapshot.cs b/CCMovieDatabase/Migrations/MovieContextModelSnapshot.cs index 727d985..5c4696f 100644 --- a/CCMovieDatabase/Migrations/MovieContextModelSnapshot.cs +++ b/CCMovieDatabase/Migrations/MovieContextModelSnapshot.cs @@ -283,6 +283,51 @@ protected override void BuildModel(ModelBuilder modelBuilder) ReleaseDate = new DateOnly(2002, 4, 26), ThumbnailURL = "https://encrypted-tbn3.gstatic.com/images?q=tbn:ANd9GcTPx7lW6h0G1O9-npEnVPL07fT74Tp6SFl0i47nxfypyVBcQFdS", Title = "Shrek 2" + }, + new + { + Id = 3, + Description = "When Ash Williams is accidentally transported to 1300 A.D., he must retrieve the Necronomicon and battle an army of the dead in order to return home.", + RatingId = 2, + ReleaseDate = new DateOnly(1993, 2, 19), + ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.impawards.com%2F1993%2Fposters%2Farmy_of_darkness_ver3.jpg&f=1&nofb=1&ipt=0f5ba9f7dec46adcdb32748f094b542e4b5c8eff313c6811ef1bea9fde96af7d", + Title = "Army of Darkness" + }, + new + { + Id = 4, + Description = "An insurance salesman begins to suspect that his whole life is actually some sort of reality TV show.", + RatingId = 4, + ReleaseDate = new DateOnly(1998, 6, 5), + ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fpostertok.com%2Fwp-content%2Fuploads%2F2024%2F02%2F5337.webp&f=1&nofb=1&ipt=0e1573f1b1d07b5daa12a781e53f49b27c130790c4d2dcde54916cc0eff9f901", + Title = "The Truman Show" + }, + new + { + Id = 5, + Description = "A designer makes a grievous mistake when he rejects the friendship of a borderline cable guy.", + RatingId = 1, + ReleaseDate = new DateOnly(1996, 6, 14), + ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Fc8.alamy.com%2Fcomp%2FBKG4ED%2Fthe-cable-guy-1996-poster-BKG4ED.jpg&f=1&nofb=1&ipt=04d76ad2b1e8ab66bd02da1ce264a9d679f0f2cad012d7c99c0ac192572af20b", + Title = "The Cable Guy" + }, + new + { + Id = 6, + Description = "After being bitten by a genetically-modified spider, a shy teenager gains spider-like abilities that he uses to fight injustice as a masked superhero and face a vengeful enemy.", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 5, 3), + ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=https%3A%2F%2Famc-theatres-res.cloudinary.com%2Fv1579117618%2Famc-cdn%2Fproduction%2F2%2Fmovies%2F3500%2F3499%2FPoster%2Fp_800x1200_Spider-Man_En_0802517.jpg&f=1&nofb=1&ipt=a5788d911cca9535bbb702afd5665df889150246b214e4f0394fc6f0a1e6f798", + Title = "Spider-Man" + }, + new + { + Id = 7, + Description = "Jack Skellington, king of Halloween Town, discovers Christmas Town, but his attempts to bring Christmas to his home causes confusion.", + RatingId = 4, + ReleaseDate = new DateOnly(1993, 10, 29), + ThumbnailURL = "https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.impawards.com%2F1993%2Fposters%2Fnightmare_before_christmas_ver1.jpg&f=1&nofb=1&ipt=a3fc758eba9bddd233e7d4e35b4511f5d2f2482e2d85d1589232c9d6a4c4efe6", + Title = "The Nightmare Before Christmas" }); }); @@ -393,6 +438,11 @@ protected override void BuildModel(ModelBuilder modelBuilder) { RatingId = 3, Name = "G" + }, + new + { + RatingId = 4, + Name = "PG" }); }); diff --git a/CCMovieDatabase/Views/Aedon/Create.cshtml b/CCMovieDatabase/Views/Aedon/Create.cshtml new file mode 100644 index 0000000..7fda2c8 --- /dev/null +++ b/CCMovieDatabase/Views/Aedon/Create.cshtml @@ -0,0 +1,52 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Create"; +} + +

Create

+ +

Movie

+
+
+
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + +
+
+ + + +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/Aedon/Delete.cshtml b/CCMovieDatabase/Views/Aedon/Delete.cshtml new file mode 100644 index 0000000..c8ce47f --- /dev/null +++ b/CCMovieDatabase/Views/Aedon/Delete.cshtml @@ -0,0 +1,51 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Delete"; +} + +

Delete

+ +

Are you sure you want to delete this?

+
+

Movie

+
+
+
+ @Html.DisplayNameFor(model => model.Title) +
+
+ @Html.DisplayFor(model => model.Title) +
+
+ @Html.DisplayNameFor(model => model.Description) +
+
+ @Html.DisplayFor(model => model.Description) +
+
+ @Html.DisplayNameFor(model => model.ReleaseDate) +
+
+ @Html.DisplayFor(model => model.ReleaseDate) +
+
+ @Html.DisplayNameFor(model => model.ThumbnailURL) +
+
+ @Html.DisplayFor(model => model.ThumbnailURL) +
+
+ @Html.DisplayNameFor(model => model.Rating) +
+
+ @Html.DisplayFor(model => model.Rating.RatingId) +
+
+ +
+ + | + Back to List +
+
diff --git a/CCMovieDatabase/Views/Aedon/Details.cshtml b/CCMovieDatabase/Views/Aedon/Details.cshtml new file mode 100644 index 0000000..ba7197f --- /dev/null +++ b/CCMovieDatabase/Views/Aedon/Details.cshtml @@ -0,0 +1,48 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Details"; +} + +

Details

+ +
+

Movie

+
+
+
+ @Html.DisplayNameFor(model => model.Title) +
+
+ @Html.DisplayFor(model => model.Title) +
+
+ @Html.DisplayNameFor(model => model.Description) +
+
+ @Html.DisplayFor(model => model.Description) +
+
+ @Html.DisplayNameFor(model => model.ReleaseDate) +
+
+ @Html.DisplayFor(model => model.ReleaseDate) +
+
+ @Html.DisplayNameFor(model => model.ThumbnailURL) +
+
+ @Html.DisplayFor(model => model.ThumbnailURL) +
+
+ @Html.DisplayNameFor(model => model.Rating) +
+
+ @Html.DisplayFor(model => model.Rating.RatingId) +
+
+
+ diff --git a/CCMovieDatabase/Views/Aedon/Edit.cshtml b/CCMovieDatabase/Views/Aedon/Edit.cshtml new file mode 100644 index 0000000..3ac2c75 --- /dev/null +++ b/CCMovieDatabase/Views/Aedon/Edit.cshtml @@ -0,0 +1,54 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Edit"; +} + +

Edit

+ +

Movie

+
+
+
+
+
+ +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/Aedon/Index.cshtml b/CCMovieDatabase/Views/Aedon/Index.cshtml new file mode 100644 index 0000000..f7d2538 --- /dev/null +++ b/CCMovieDatabase/Views/Aedon/Index.cshtml @@ -0,0 +1,66 @@ +@model IEnumerable + +@{ + ViewData["Title"] = "Index"; +} + +

Index

+ +

+ Create New +

+ + + + + + + + + + + + +@foreach (var item in Model) { + + + + + + + + +} + +
+ @Html.DisplayNameFor(model => model.Title) + + @Html.DisplayNameFor(model => model.Description) + + @Html.DisplayNameFor(model => model.ReleaseDate) + + @Html.DisplayNameFor(model => model.ThumbnailURL) + + @Html.DisplayNameFor(model => model.Rating) +
+ @Html.DisplayFor(modelItem => item.Title) + + @Html.DisplayFor(modelItem => item.Description) + + @Html.DisplayFor(modelItem => item.ReleaseDate) + + @if (item.ThumbnailURL != null) + { + + } + else + { +

No Thumbnail

+ } +
+ @Html.DisplayFor(modelItem => item.Rating.RatingId) + + Edit | + Details | + Delete +
diff --git a/CCMovieDatabase/Views/Shared/_Layout.cshtml b/CCMovieDatabase/Views/Shared/_Layout.cshtml index e4479e4..b1a4f3b 100644 --- a/CCMovieDatabase/Views/Shared/_Layout.cshtml +++ b/CCMovieDatabase/Views/Shared/_Layout.cshtml @@ -35,6 +35,9 @@ +