From 7adbdf191996cc17b31ed1894886bd8added3b4c Mon Sep 17 00:00:00 2001 From: jamel Date: Sun, 7 Dec 2025 20:32:23 -0800 Subject: [PATCH] final project --- CCMovieDatabase/CCMovieDatabase.csproj.user | 5 + .../Controllers/JamelController2.cs | 158 +++++++ .../Controllers/JamelsController1.cs | 166 +++++++ CCMovieDatabase/Data/MovieContext.cs | 7 + .../20251206033246_Sonic 3.Designer.cs | 416 ++++++++++++++++++ .../Migrations/20251206033246_Sonic 3.cs | 58 +++ .../20251206034316_newcontroller.Designer.cs | 416 ++++++++++++++++++ .../20251206034316_newcontroller.cs | 22 + ...0251207060352_jamelcontroller2.Designer.cs | 416 ++++++++++++++++++ .../20251207060352_jamelcontroller2.cs | 22 + .../Migrations/MovieContextModelSnapshot.cs | 40 ++ .../Views/JamelController2/Create.cshtml | 47 ++ .../Views/JamelController2/Delete.cshtml | 45 ++ .../Views/JamelController2/Details.cshtml | 42 ++ .../Views/JamelController2/Edit.cshtml | 49 +++ .../Views/JamelController2/Index.cshtml | 53 +++ .../Views/JamelsController1/Create.cshtml | 47 ++ .../Views/JamelsController1/Delete.cshtml | 45 ++ .../Views/JamelsController1/Details.cshtml | 42 ++ .../Views/JamelsController1/Edit.cshtml | 49 +++ .../Views/JamelsController1/Index.cshtml | 53 +++ CCMovieDatabase/Views/Shared/_Layout.cshtml | 6 + 22 files changed, 2204 insertions(+) create mode 100644 CCMovieDatabase/Controllers/JamelController2.cs create mode 100644 CCMovieDatabase/Controllers/JamelsController1.cs create mode 100644 CCMovieDatabase/Migrations/20251206033246_Sonic 3.Designer.cs create mode 100644 CCMovieDatabase/Migrations/20251206033246_Sonic 3.cs create mode 100644 CCMovieDatabase/Migrations/20251206034316_newcontroller.Designer.cs create mode 100644 CCMovieDatabase/Migrations/20251206034316_newcontroller.cs create mode 100644 CCMovieDatabase/Migrations/20251207060352_jamelcontroller2.Designer.cs create mode 100644 CCMovieDatabase/Migrations/20251207060352_jamelcontroller2.cs create mode 100644 CCMovieDatabase/Views/JamelController2/Create.cshtml create mode 100644 CCMovieDatabase/Views/JamelController2/Delete.cshtml create mode 100644 CCMovieDatabase/Views/JamelController2/Details.cshtml create mode 100644 CCMovieDatabase/Views/JamelController2/Edit.cshtml create mode 100644 CCMovieDatabase/Views/JamelController2/Index.cshtml create mode 100644 CCMovieDatabase/Views/JamelsController1/Create.cshtml create mode 100644 CCMovieDatabase/Views/JamelsController1/Delete.cshtml create mode 100644 CCMovieDatabase/Views/JamelsController1/Details.cshtml create mode 100644 CCMovieDatabase/Views/JamelsController1/Edit.cshtml create mode 100644 CCMovieDatabase/Views/JamelsController1/Index.cshtml diff --git a/CCMovieDatabase/CCMovieDatabase.csproj.user b/CCMovieDatabase/CCMovieDatabase.csproj.user index 904fdb0..1b99309 100644 --- a/CCMovieDatabase/CCMovieDatabase.csproj.user +++ b/CCMovieDatabase/CCMovieDatabase.csproj.user @@ -13,5 +13,10 @@ CCMovieDatabase.Data.MovieContext False True + MvcControllerEmptyScaffolder + root/Common/MVC/Controller + RazorViewEmptyScaffolder + root/Common/MVC/View + 650 \ No newline at end of file diff --git a/CCMovieDatabase/Controllers/JamelController2.cs b/CCMovieDatabase/Controllers/JamelController2.cs new file mode 100644 index 0000000..e12544e --- /dev/null +++ b/CCMovieDatabase/Controllers/JamelController2.cs @@ -0,0 +1,158 @@ +using CCMovieDatabase.Data; +using CCMovieDatabase.Models; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.EntityFrameworkCore; + +namespace CCMovieDatabase.Controllers +{ + public class JamelController2 : Controller + { + private readonly MovieContext _context; + // i tried to seperate the description and titles into 2 seperate pages and it did not work + // im keeping all the code here to show my thought process + + public JamelController2(MovieContext context) + { + _context = context; + } + + public async Task Index2() + { + var movieContext = _context.Movie.Include(m => m.Description); + return View(await movieContext.ToListAsync()); + } + + + 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); + } + + + public IActionResult Create() + { + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId"); + return View(); + } + + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Create([Bind("Id,Title,Description,ReleaseDate,RatingId")] 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); + } + + + 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); + } + + + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Edit(int id, [Bind("Id,Title,Description,ReleaseDate,RatingId")] 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); + } + + + 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); + } + + [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/Controllers/JamelsController1.cs b/CCMovieDatabase/Controllers/JamelsController1.cs new file mode 100644 index 0000000..f3a9130 --- /dev/null +++ b/CCMovieDatabase/Controllers/JamelsController1.cs @@ -0,0 +1,166 @@ +using CCMovieDatabase.Data; +using CCMovieDatabase.Models; +using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc.Rendering; +using Microsoft.EntityFrameworkCore; + +namespace CCMovieDatabase.Controllers +{ + public class JamelsController1 : Controller + { + private readonly MovieContext _context; + + public JamelsController1(MovieContext context) + { + _context = context; + } + + // i could not figure out how to only display movies and descriptions separately so I put into comments the code I wrote that did not work + // the titles and descriptions show up but i could not get them separately + public async Task Index() + { + var movieContext = _context.Movie.Include(m => m.Rating); + return View(await movieContext.ToListAsync()); + + //var movieContext = _context.Movie.Include(m => m.Title); + //return View(await movieContext.ToListAsync()); + + } + // this code works + public async Task Index2() + { + var movieContext = _context.Movie.Include(m => m.Description); + return View(await movieContext.ToListAsync()); + } + + + 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); + } + + + public IActionResult Create() + { + ViewData["RatingId"] = new SelectList(_context.Ratings, "RatingId", "RatingId"); + return View(); + } + + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Create([Bind("Id,Title,Description,ReleaseDate,RatingId")] 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); + } + + + 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); + } + + + [HttpPost] + [ValidateAntiForgeryToken] + public async Task Edit(int id, [Bind("Id,Title,Description,ReleaseDate,RatingId")] 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); + } + + + 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); + } + + [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 9eea68c..a939172 100644 --- a/CCMovieDatabase/Data/MovieContext.cs +++ b/CCMovieDatabase/Data/MovieContext.cs @@ -36,10 +36,17 @@ protected override void OnModelCreating(ModelBuilder modelBuilder) modelBuilder.Entity().HasData(ratings); // right here we seed data + // im not a big movie guy so I ran out of movie ideas + // I also made the descriptions myself as I really like all these shows and movies var movies = new List { 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 }, new Movie { Id = 2, Title = "Shrek 2", ReleaseDate = new DateOnly(2002, 04, 26), Description = "Shrek is back baby!", RatingId = 1 }, + new Movie { Id = 3, Title = "Sonic 3", ReleaseDate = new DateOnly(2024, 12, 20), Description = "The third sonic movie focusing on shadow and the sonic adventure 2 inspired story", RatingId = 1 }, + new Movie { Id = 4, Title = "Star Wars Revenge of ths sith", ReleaseDate = new DateOnly(2005, 04, 26), Description = "The final movie in the prequel trilogy connecting it to the original trilogy", RatingId = 1 }, + new Movie { Id = 5, Title = "Avatar the last airbender", ReleaseDate = new DateOnly(2005, 02, 21), Description = "about the avatar a supposed master of the 4 bending elements ", RatingId = 1 }, + new Movie { Id = 6, Title = "Frieren: Beyond Journeys ENd", ReleaseDate = new DateOnly(2023, 09, 29), Description = "about an immortal elf that goes on an adventure to understand the meaning of the limited time poeple have", RatingId = 1 }, + new Movie { Id = 7, Title = "The Mario Movie", ReleaseDate = new DateOnly(2023, 04, 05), Description = "The mario movie giving a diffrent story of how Mario came to the Mushroom kingdom", RatingId = 1 }, }; diff --git a/CCMovieDatabase/Migrations/20251206033246_Sonic 3.Designer.cs b/CCMovieDatabase/Migrations/20251206033246_Sonic 3.Designer.cs new file mode 100644 index 0000000..a016f04 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251206033246_Sonic 3.Designer.cs @@ -0,0 +1,416 @@ +// +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("20251206033246_Sonic 3")] + partial class Sonic3 + { + /// + 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.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("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), + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + Title = "Shrek 2" + }, + new + { + Id = 3, + Description = "The third sonic movie focusing on shadow and the sonic adventure 2 inspired story", + RatingId = 1, + ReleaseDate = new DateOnly(2024, 12, 20), + Title = "Sonic 3" + }, + new + { + Id = 4, + Description = "The final movie in the prequel trilogy connecting it to the original trilogy", + RatingId = 1, + ReleaseDate = new DateOnly(2005, 4, 26), + Title = "Star Wars Revenge of ths sith" + }, + new + { + Id = 5, + Description = "about the avatar a supposed master of the 4 bending elements ", + RatingId = 1, + ReleaseDate = new DateOnly(2005, 2, 21), + Title = "Avatar the last airbender" + }, + new + { + Id = 6, + Description = "about an immortal elf that goes on an adventure to understand the meaning of the limited time poeple have", + RatingId = 1, + ReleaseDate = new DateOnly(2023, 9, 29), + Title = "Frieren: Beyond Journeys ENd" + }, + new + { + Id = 7, + Description = "The mario movie giving a diffrent story of how Mario came to the Mushroom kingdom", + RatingId = 1, + ReleaseDate = new DateOnly(2023, 4, 5), + Title = "The Mario Movie" + }); + }); + + 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.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" + }); + }); + + 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.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/20251206033246_Sonic 3.cs b/CCMovieDatabase/Migrations/20251206033246_Sonic 3.cs new file mode 100644 index 0000000..2f118ce --- /dev/null +++ b/CCMovieDatabase/Migrations/20251206033246_Sonic 3.cs @@ -0,0 +1,58 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class Sonic3 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.InsertData( + table: "Movie", + columns: new[] { "Id", "Description", "RatingId", "ReleaseDate", "Title" }, + values: new object[,] + { + { 3, "The third sonic movie focusing on shadow and the sonic adventure 2 inspired story", 1, new DateOnly(2024, 12, 20), "Sonic 3" }, + { 4, "The final movie in the prequel trilogy connecting it to the original trilogy", 1, new DateOnly(2005, 4, 26), "Star Wars Revenge of ths sith" }, + { 5, "about the avatar a supposed master of the 4 bending elements ", 1, new DateOnly(2005, 2, 21), "Avatar the last airbender" }, + { 6, "about an immortal elf that goes on an adventure to understand the meaning of the limited time poeple have", 1, new DateOnly(2023, 9, 29), "Frieren: Beyond Journeys ENd" }, + { 7, "The mario movie giving a diffrent story of how Mario came to the Mushroom kingdom", 1, new DateOnly(2023, 4, 5), "The Mario Movie" } + }); + } + + /// + 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); + } + } +} diff --git a/CCMovieDatabase/Migrations/20251206034316_newcontroller.Designer.cs b/CCMovieDatabase/Migrations/20251206034316_newcontroller.Designer.cs new file mode 100644 index 0000000..e7c18cb --- /dev/null +++ b/CCMovieDatabase/Migrations/20251206034316_newcontroller.Designer.cs @@ -0,0 +1,416 @@ +// +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("20251206034316_newcontroller")] + partial class newcontroller + { + /// + 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.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("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), + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + Title = "Shrek 2" + }, + new + { + Id = 3, + Description = "The third sonic movie focusing on shadow and the sonic adventure 2 inspired story", + RatingId = 1, + ReleaseDate = new DateOnly(2024, 12, 20), + Title = "Sonic 3" + }, + new + { + Id = 4, + Description = "The final movie in the prequel trilogy connecting it to the original trilogy", + RatingId = 1, + ReleaseDate = new DateOnly(2005, 4, 26), + Title = "Star Wars Revenge of ths sith" + }, + new + { + Id = 5, + Description = "about the avatar a supposed master of the 4 bending elements ", + RatingId = 1, + ReleaseDate = new DateOnly(2005, 2, 21), + Title = "Avatar the last airbender" + }, + new + { + Id = 6, + Description = "about an immortal elf that goes on an adventure to understand the meaning of the limited time poeple have", + RatingId = 1, + ReleaseDate = new DateOnly(2023, 9, 29), + Title = "Frieren: Beyond Journeys ENd" + }, + new + { + Id = 7, + Description = "The mario movie giving a diffrent story of how Mario came to the Mushroom kingdom", + RatingId = 1, + ReleaseDate = new DateOnly(2023, 4, 5), + Title = "The Mario Movie" + }); + }); + + 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.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" + }); + }); + + 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.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/20251206034316_newcontroller.cs b/CCMovieDatabase/Migrations/20251206034316_newcontroller.cs new file mode 100644 index 0000000..baa5c00 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251206034316_newcontroller.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class newcontroller : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/CCMovieDatabase/Migrations/20251207060352_jamelcontroller2.Designer.cs b/CCMovieDatabase/Migrations/20251207060352_jamelcontroller2.Designer.cs new file mode 100644 index 0000000..74e0d38 --- /dev/null +++ b/CCMovieDatabase/Migrations/20251207060352_jamelcontroller2.Designer.cs @@ -0,0 +1,416 @@ +// +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("20251207060352_jamelcontroller2")] + partial class jamelcontroller2 + { + /// + 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.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("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), + Title = "Shrek" + }, + new + { + Id = 2, + Description = "Shrek is back baby!", + RatingId = 1, + ReleaseDate = new DateOnly(2002, 4, 26), + Title = "Shrek 2" + }, + new + { + Id = 3, + Description = "The third sonic movie focusing on shadow and the sonic adventure 2 inspired story", + RatingId = 1, + ReleaseDate = new DateOnly(2024, 12, 20), + Title = "Sonic 3" + }, + new + { + Id = 4, + Description = "The final movie in the prequel trilogy connecting it to the original trilogy", + RatingId = 1, + ReleaseDate = new DateOnly(2005, 4, 26), + Title = "Star Wars Revenge of ths sith" + }, + new + { + Id = 5, + Description = "about the avatar a supposed master of the 4 bending elements ", + RatingId = 1, + ReleaseDate = new DateOnly(2005, 2, 21), + Title = "Avatar the last airbender" + }, + new + { + Id = 6, + Description = "about an immortal elf that goes on an adventure to understand the meaning of the limited time poeple have", + RatingId = 1, + ReleaseDate = new DateOnly(2023, 9, 29), + Title = "Frieren: Beyond Journeys ENd" + }, + new + { + Id = 7, + Description = "The mario movie giving a diffrent story of how Mario came to the Mushroom kingdom", + RatingId = 1, + ReleaseDate = new DateOnly(2023, 4, 5), + Title = "The Mario Movie" + }); + }); + + 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.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" + }); + }); + + 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.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/20251207060352_jamelcontroller2.cs b/CCMovieDatabase/Migrations/20251207060352_jamelcontroller2.cs new file mode 100644 index 0000000..1fd206e --- /dev/null +++ b/CCMovieDatabase/Migrations/20251207060352_jamelcontroller2.cs @@ -0,0 +1,22 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace CCMovieDatabase.Migrations +{ + /// + public partial class jamelcontroller2 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + + } + } +} diff --git a/CCMovieDatabase/Migrations/MovieContextModelSnapshot.cs b/CCMovieDatabase/Migrations/MovieContextModelSnapshot.cs index 1301e40..f662b10 100644 --- a/CCMovieDatabase/Migrations/MovieContextModelSnapshot.cs +++ b/CCMovieDatabase/Migrations/MovieContextModelSnapshot.cs @@ -239,6 +239,46 @@ protected override void BuildModel(ModelBuilder modelBuilder) RatingId = 1, ReleaseDate = new DateOnly(2002, 4, 26), Title = "Shrek 2" + }, + new + { + Id = 3, + Description = "The third sonic movie focusing on shadow and the sonic adventure 2 inspired story", + RatingId = 1, + ReleaseDate = new DateOnly(2024, 12, 20), + Title = "Sonic 3" + }, + new + { + Id = 4, + Description = "The final movie in the prequel trilogy connecting it to the original trilogy", + RatingId = 1, + ReleaseDate = new DateOnly(2005, 4, 26), + Title = "Star Wars Revenge of ths sith" + }, + new + { + Id = 5, + Description = "about the avatar a supposed master of the 4 bending elements ", + RatingId = 1, + ReleaseDate = new DateOnly(2005, 2, 21), + Title = "Avatar the last airbender" + }, + new + { + Id = 6, + Description = "about an immortal elf that goes on an adventure to understand the meaning of the limited time poeple have", + RatingId = 1, + ReleaseDate = new DateOnly(2023, 9, 29), + Title = "Frieren: Beyond Journeys ENd" + }, + new + { + Id = 7, + Description = "The mario movie giving a diffrent story of how Mario came to the Mushroom kingdom", + RatingId = 1, + ReleaseDate = new DateOnly(2023, 4, 5), + Title = "The Mario Movie" }); }); diff --git a/CCMovieDatabase/Views/JamelController2/Create.cshtml b/CCMovieDatabase/Views/JamelController2/Create.cshtml new file mode 100644 index 0000000..c81c6b9 --- /dev/null +++ b/CCMovieDatabase/Views/JamelController2/Create.cshtml @@ -0,0 +1,47 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Create"; +} + +

Create

+ +

Movie

+
+
+
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/JamelController2/Delete.cshtml b/CCMovieDatabase/Views/JamelController2/Delete.cshtml new file mode 100644 index 0000000..bca40d8 --- /dev/null +++ b/CCMovieDatabase/Views/JamelController2/Delete.cshtml @@ -0,0 +1,45 @@ +@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.Rating) +
+
+ @Html.DisplayFor(model => model.Rating.RatingId) +
+
+ +
+ + | + Back to List +
+
diff --git a/CCMovieDatabase/Views/JamelController2/Details.cshtml b/CCMovieDatabase/Views/JamelController2/Details.cshtml new file mode 100644 index 0000000..1e74d7f --- /dev/null +++ b/CCMovieDatabase/Views/JamelController2/Details.cshtml @@ -0,0 +1,42 @@ +@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.Rating) +
+
+ @Html.DisplayFor(model => model.Rating.RatingId) +
+
+
+ diff --git a/CCMovieDatabase/Views/JamelController2/Edit.cshtml b/CCMovieDatabase/Views/JamelController2/Edit.cshtml new file mode 100644 index 0000000..6c3d428 --- /dev/null +++ b/CCMovieDatabase/Views/JamelController2/Edit.cshtml @@ -0,0 +1,49 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Edit"; +} + +

Edit

+ +

Movie

+
+
+
+
+
+ +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/JamelController2/Index.cshtml b/CCMovieDatabase/Views/JamelController2/Index.cshtml new file mode 100644 index 0000000..44a9d05 --- /dev/null +++ b/CCMovieDatabase/Views/JamelController2/Index.cshtml @@ -0,0 +1,53 @@ +@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.Rating) +
+ @Html.DisplayFor(modelItem => item.Title) + + @Html.DisplayFor(modelItem => item.Description) + + @Html.DisplayFor(modelItem => item.ReleaseDate) + + @Html.DisplayFor(modelItem => item.Rating.RatingId) + + Edit | + Details | + Delete +
diff --git a/CCMovieDatabase/Views/JamelsController1/Create.cshtml b/CCMovieDatabase/Views/JamelsController1/Create.cshtml new file mode 100644 index 0000000..c81c6b9 --- /dev/null +++ b/CCMovieDatabase/Views/JamelsController1/Create.cshtml @@ -0,0 +1,47 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Create"; +} + +

Create

+ +

Movie

+
+
+
+
+
+
+ + + +
+
+ + + +
+
+ + + +
+
+ + +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/JamelsController1/Delete.cshtml b/CCMovieDatabase/Views/JamelsController1/Delete.cshtml new file mode 100644 index 0000000..bca40d8 --- /dev/null +++ b/CCMovieDatabase/Views/JamelsController1/Delete.cshtml @@ -0,0 +1,45 @@ +@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.Rating) +
+
+ @Html.DisplayFor(model => model.Rating.RatingId) +
+
+ +
+ + | + Back to List +
+
diff --git a/CCMovieDatabase/Views/JamelsController1/Details.cshtml b/CCMovieDatabase/Views/JamelsController1/Details.cshtml new file mode 100644 index 0000000..1e74d7f --- /dev/null +++ b/CCMovieDatabase/Views/JamelsController1/Details.cshtml @@ -0,0 +1,42 @@ +@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.Rating) +
+
+ @Html.DisplayFor(model => model.Rating.RatingId) +
+
+
+ diff --git a/CCMovieDatabase/Views/JamelsController1/Edit.cshtml b/CCMovieDatabase/Views/JamelsController1/Edit.cshtml new file mode 100644 index 0000000..6c3d428 --- /dev/null +++ b/CCMovieDatabase/Views/JamelsController1/Edit.cshtml @@ -0,0 +1,49 @@ +@model CCMovieDatabase.Models.Movie + +@{ + ViewData["Title"] = "Edit"; +} + +

Edit

+ +

Movie

+
+
+
+
+
+ +
+ + + +
+
+ + + +
+
+ + + +
+
+ + + +
+
+ +
+
+
+
+ + + +@section Scripts { + @{await Html.RenderPartialAsync("_ValidationScriptsPartial");} +} diff --git a/CCMovieDatabase/Views/JamelsController1/Index.cshtml b/CCMovieDatabase/Views/JamelsController1/Index.cshtml new file mode 100644 index 0000000..44a9d05 --- /dev/null +++ b/CCMovieDatabase/Views/JamelsController1/Index.cshtml @@ -0,0 +1,53 @@ +@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.Rating) +
+ @Html.DisplayFor(modelItem => item.Title) + + @Html.DisplayFor(modelItem => item.Description) + + @Html.DisplayFor(modelItem => item.ReleaseDate) + + @Html.DisplayFor(modelItem => item.Rating.RatingId) + + Edit | + Details | + Delete +
diff --git a/CCMovieDatabase/Views/Shared/_Layout.cshtml b/CCMovieDatabase/Views/Shared/_Layout.cshtml index 4f03822..de105ca 100644 --- a/CCMovieDatabase/Views/Shared/_Layout.cshtml +++ b/CCMovieDatabase/Views/Shared/_Layout.cshtml @@ -35,6 +35,12 @@ + +