From 4fd8b07cc64d9368e4c91eb591b6e229cbf1b3ff Mon Sep 17 00:00:00 2001 From: Kevin MONDEJAR Date: Thu, 13 Mar 2025 12:02:29 +0100 Subject: [PATCH] =?UTF-8?q?modif=20entity=20+=20ajout=20donn=C3=A9es=20stu?= =?UTF-8?q?ber?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- WF_EF_Api/Contextlib/WTFContext.cs | 28 ++--- WF_EF_Api/Entity/Admin.cs | 8 +- WF_EF_Api/Entity/Character.cs | 15 ++- WF_EF_Api/Entity/Commentary.cs | 24 +++- WF_EF_Api/Entity/DailyQuote.cs | 6 + WF_EF_Api/Entity/Favorite.cs | 15 ++- WF_EF_Api/Entity/Images.cs | 7 ++ WF_EF_Api/Entity/LangEnum.cs | 3 +- WF_EF_Api/Entity/Question.cs | 23 ++++ WF_EF_Api/Entity/Quiz.cs | 18 ++- WF_EF_Api/Entity/QuizQuestion.cs | 15 ++- WF_EF_Api/Entity/Quote.cs | 34 +++++- WF_EF_Api/Entity/RecordQuiz.cs | 1 + WF_EF_Api/Entity/Source.cs | 16 ++- WF_EF_Api/Entity/TypeSrcEnum.cs | 16 +++ WF_EF_Api/Entity/Users.cs | 20 ++- WF_EF_Api/StubbedContextLib/StubWTFContext.cs | 115 ++++++++++++++++-- 17 files changed, 325 insertions(+), 39 deletions(-) create mode 100644 WF_EF_Api/Entity/TypeSrcEnum.cs diff --git a/WF_EF_Api/Contextlib/WTFContext.cs b/WF_EF_Api/Contextlib/WTFContext.cs index c27565d..02880c7 100644 --- a/WF_EF_Api/Contextlib/WTFContext.cs +++ b/WF_EF_Api/Contextlib/WTFContext.cs @@ -10,22 +10,22 @@ namespace Contextlib { public class WTFContext : DbContext { - public DbSet Images { get; set; } - public DbSet Users { get; set; } - //public DbSet Admin { get; set; } - public DbSet Question { get; set; } - public DbSet Quiz { get; set; } - //public DbSet QuizQuestion { get; set; } - //public DbSet RecordQuiz { get; set; } - public DbSet Source { get; set; } - public DbSet Character { get; set; } - public DbSet Quote { get; set; } - //public DbSet DailyQuote { get; set; } - //public DbSet Favorite { get; set; } - //public DbSet Commentary { get; set; } + public DbSet admins { get; set; } + public DbSet characters { get; set; } + public DbSet comments { get; set; } + public DbSet dailyquotes { get; set; } + public DbSet favorites { get; set; } + public DbSet images { get; set; } + public DbSet question { get; set; } + public DbSet quizzes { get; set; } + public DbSet quizQuestions { get; set; } + public DbSet quotes { get; set; } + //public DbSet records { get; set; } + public DbSet sources { get; set; } + public DbSet users { get; set; } protected override void OnConfiguring(DbContextOptionsBuilder options) - => options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=myFirstDatabase.mdf;Trusted_Connection=True;"); + => options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=WfDatabase.mdf;Trusted_Connection=True;"); } } diff --git a/WF_EF_Api/Entity/Admin.cs b/WF_EF_Api/Entity/Admin.cs index 4b1ea8e..0c62388 100644 --- a/WF_EF_Api/Entity/Admin.cs +++ b/WF_EF_Api/Entity/Admin.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,6 +10,10 @@ namespace Entity { public class Admin { - //public int IdUsers { get; set; } + [Key] + [ForeignKey(nameof(Users))] + public int IdUsers { get; set; } + + public Users User { get; set; } = null!; } } diff --git a/WF_EF_Api/Entity/Character.cs b/WF_EF_Api/Entity/Character.cs index 22643e6..f1ba455 100644 --- a/WF_EF_Api/Entity/Character.cs +++ b/WF_EF_Api/Entity/Character.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,8 +10,19 @@ namespace Entity { public class Character { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } + + [Required] + [StringLength(50)] public string Name { get; set; } - //public int IdImage { get; set; } + + [ForeignKey(nameof(Images))] + public int IdImage { get; set; } + + public Images Images { get; set; } = null!; + + public ICollection Quotes { get; set; } = new List(); } } diff --git a/WF_EF_Api/Entity/Commentary.cs b/WF_EF_Api/Entity/Commentary.cs index b07ecdf..07649d2 100644 --- a/WF_EF_Api/Entity/Commentary.cs +++ b/WF_EF_Api/Entity/Commentary.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,10 +10,28 @@ namespace Entity { public class Commentary { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } - //public int IdUsers { get; set; } - //public int IdQuote { get; set; } + + [Required] + [ForeignKey(nameof(Users))] + public int IdUsers { get; set; } + + [Required] + [ForeignKey(nameof(Quote))] + public int IdQuote { get; set; } + + [Required] + [Column("DateCommentary", TypeName = "date")] public DateTime DateCommentary { get; set; } + + [Required] + [MaxLength(100)] public string Comment { get; set; } + + public Quote Quote { get; set; } = null!; + + public Users Users { get; set; } = null!; } } diff --git a/WF_EF_Api/Entity/DailyQuote.cs b/WF_EF_Api/Entity/DailyQuote.cs index 350290c..04aa8c5 100644 --- a/WF_EF_Api/Entity/DailyQuote.cs +++ b/WF_EF_Api/Entity/DailyQuote.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,6 +10,10 @@ namespace Entity { public class DailyQuote { + [Key] + [ForeignKey(nameof(Quote))] public int IdQuote { get; set; } + + public Quote Quote { get; set; } = null!; } } diff --git a/WF_EF_Api/Entity/Favorite.cs b/WF_EF_Api/Entity/Favorite.cs index 0d6705e..51165d5 100644 --- a/WF_EF_Api/Entity/Favorite.cs +++ b/WF_EF_Api/Entity/Favorite.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,7 +10,16 @@ namespace Entity { public class Favorite { - //public int IdUsers { get; set; } - //public int IdQuote { get; set; } + [Key] + [ForeignKey(nameof(Users))] + public int IdUsers { get; set; } + + [Key] + [ForeignKey(nameof(Quote))] + public int IdQuote { get; set; } + + public Users User { get; set; } = null!; + + public Quote Quote { get; set; } = null!; } } diff --git a/WF_EF_Api/Entity/Images.cs b/WF_EF_Api/Entity/Images.cs index 27fc63f..d03b214 100644 --- a/WF_EF_Api/Entity/Images.cs +++ b/WF_EF_Api/Entity/Images.cs @@ -13,7 +13,14 @@ namespace Entity [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } + + [Required] public string ImgPath { get; set; } + + public ICollection Characters { get; set; } = new List(); + public ICollection Users { get; set; } = new List(); + + public ICollection Quizs { get; set; } = new List(); } } diff --git a/WF_EF_Api/Entity/LangEnum.cs b/WF_EF_Api/Entity/LangEnum.cs index a3238c3..3f8f2a1 100644 --- a/WF_EF_Api/Entity/LangEnum.cs +++ b/WF_EF_Api/Entity/LangEnum.cs @@ -9,7 +9,6 @@ namespace Entity public enum LangEnum { vo, - fr, - en + vf } } diff --git a/WF_EF_Api/Entity/Question.cs b/WF_EF_Api/Entity/Question.cs index 5bc982c..df66009 100644 --- a/WF_EF_Api/Entity/Question.cs +++ b/WF_EF_Api/Entity/Question.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,13 +10,34 @@ namespace Entity { public class Question { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } + + [Required] + [StringLength(50)] public string Text { get; set; } + + [Required] + [StringLength(50)] public string AnswerA { get; set; } + + [Required] + [StringLength(50)] public string AnswerB { get; set; } + + [Required] + [StringLength(50)] public string AnswerC { get; set; } + + [Required] + [StringLength(50)] public string AnswerD { get; set; } + + [Required] + [StringLength(1)] public string CorrectAnswer { get; set; } + public ICollection Quizs { get; } = new List(); } } diff --git a/WF_EF_Api/Entity/Quiz.cs b/WF_EF_Api/Entity/Quiz.cs index 11e7bb5..27f69ee 100644 --- a/WF_EF_Api/Entity/Quiz.cs +++ b/WF_EF_Api/Entity/Quiz.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,9 +10,23 @@ namespace Entity { public class Quiz { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } + + [Required] + [StringLength(50)] public string Title { get; set; } - //public int IdImage { get; set; } + + [Required] + [ForeignKey(nameof(Images))] + public int IdImage { get; set; } + + [Required] public int NbQuestion { get; set; } + + public Images Images { get; set; } = null!; + + public ICollection Questions { get; } = new List(); } } diff --git a/WF_EF_Api/Entity/QuizQuestion.cs b/WF_EF_Api/Entity/QuizQuestion.cs index a62ba83..eaf51c3 100644 --- a/WF_EF_Api/Entity/QuizQuestion.cs +++ b/WF_EF_Api/Entity/QuizQuestion.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,7 +10,16 @@ namespace Entity { public class QuizQuestion { - //public int IdQuiz { get; set; } - //public int IdQuestion { get; set; } + [Key] + [ForeignKey(nameof(Quiz))] + public int IdQuiz { get; set; } + + [Key] + [ForeignKey(nameof(Question))] + public int IdQuestion { get; set; } + + public Quiz Quiz { get; set; } = null!; + + public Question Question { get; set; } = null!; } } diff --git a/WF_EF_Api/Entity/Quote.cs b/WF_EF_Api/Entity/Quote.cs index 57621c1..adc1dd8 100644 --- a/WF_EF_Api/Entity/Quote.cs +++ b/WF_EF_Api/Entity/Quote.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,13 +10,39 @@ namespace Entity { public class Quote { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } + + [Required] + [StringLength(50)] public string Content { get; set; } + + [Required] public int Likes { get; set; } + + [Required] public LangEnum Langage { get; set; } + + [Required] public bool IsValid { get; set; } - //public int IdCharacter { get; set; } - //public int IdSource { get; set; } - //public int IdUsersPropose { get; set; } + + [Required] + [ForeignKey(nameof(Character))] + public int IdCharacter { get; set; } + + [Required] + [ForeignKey(nameof(Source))] + public int IdSource { get; set; } + + [Required] + [ForeignKey(nameof(Users))] + public int IdUsersPropose { get; set; } + + public ICollection DailyQuotes { get; set; } = new List(); + + public ICollection commentaries { get; set; } = new List(); + + public ICollection Favorite { get; set; } = new List(); } } diff --git a/WF_EF_Api/Entity/RecordQuiz.cs b/WF_EF_Api/Entity/RecordQuiz.cs index 5ddc02d..4a6a689 100644 --- a/WF_EF_Api/Entity/RecordQuiz.cs +++ b/WF_EF_Api/Entity/RecordQuiz.cs @@ -6,6 +6,7 @@ using System.Threading.Tasks; namespace Entity { + // Peut etre enlever car inutiliser public class RecordQuiz { public int IdUsers { get; set; } diff --git a/WF_EF_Api/Entity/Source.cs b/WF_EF_Api/Entity/Source.cs index 18f242e..4a9f77c 100644 --- a/WF_EF_Api/Entity/Source.cs +++ b/WF_EF_Api/Entity/Source.cs @@ -1,5 +1,7 @@ using System; using System.Collections.Generic; +using System.ComponentModel.DataAnnotations.Schema; +using System.ComponentModel.DataAnnotations; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -8,8 +10,20 @@ namespace Entity { public class Source { + [Key] + [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } + + [Required] + [StringLength(50)] public string Title { get; set; } - public int Year { get; set; } + + [Required] + public int Year { get; set; } + + [Required] + public TypeSrcEnum TypeSrc { get; set; } + + public ICollection Quotes { get; set; } = new List(); } } diff --git a/WF_EF_Api/Entity/TypeSrcEnum.cs b/WF_EF_Api/Entity/TypeSrcEnum.cs new file mode 100644 index 0000000..b5aa4e1 --- /dev/null +++ b/WF_EF_Api/Entity/TypeSrcEnum.cs @@ -0,0 +1,16 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Entity +{ + public enum TypeSrcEnum + { + movie, + series, + book, + videogame + } +} diff --git a/WF_EF_Api/Entity/Users.cs b/WF_EF_Api/Entity/Users.cs index c5049f7..81aa506 100644 --- a/WF_EF_Api/Entity/Users.cs +++ b/WF_EF_Api/Entity/Users.cs @@ -13,14 +13,32 @@ namespace Entity [Key] [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public int Id { get; set; } + + [Required] + [StringLength(50)] public string UserName { get; set; } + + [Required] + [StringLength(50)] public string Email { get; set; } + + [Required] + [StringLength(200)] public string Password { get; set; } [ForeignKey(nameof(Images))] public int IdImage { get; set; } - public Images Images { get; set; } + [Required] + [Column("Created", TypeName = "date")] public DateTime Created { get; set; } + + public Images Images { get; set; } + + public ICollection Quotes { get; set; } = new List(); + + public ICollection Commentary { get; set; } = new List(); + + public ICollection Favorite { get; set; } = new List(); } } diff --git a/WF_EF_Api/StubbedContextLib/StubWTFContext.cs b/WF_EF_Api/StubbedContextLib/StubWTFContext.cs index 8d983a4..8ef24d8 100644 --- a/WF_EF_Api/StubbedContextLib/StubWTFContext.cs +++ b/WF_EF_Api/StubbedContextLib/StubWTFContext.cs @@ -15,20 +15,117 @@ namespace StubbedContextLib { base.OnModelCreating(modelBuilder); - modelBuilder.Entity() - .HasMany(i => i.Users) - .WithOne(u => u.Images) - .HasForeignKey(u => u.IdImage) - .IsRequired(); + modelBuilder.Entity().HasData( + new Admin() { IdUsers = 1 } + ); + + modelBuilder.Entity().HasData( + new Character() { Id = 1 , Name = "Alan Grant", IdImage = 1}, + new Character() { Id = 2, Name = "Aragorn", IdImage = 2 }, + new Character() { Id = 3, Name = "Legolas", IdImage = 3 }, + new Character() { Id = 4, Name = "Frodon", IdImage = 4 }, + new Character() { Id = 5, Name = "Dobby", IdImage = 5 }, + new Character() { Id = 6, Name = "Jon Snow", IdImage = 6 }, + new Character() { Id = 7, Name = "Daenerys Targaryen", IdImage = 7 }, + new Character() { Id = 8, Name = "Luke Skywalker", IdImage = 8 }, + new Character() { Id = 9, Name = "Princess Leia", IdImage = 9 }, + new Character() { Id = 10, Name = "Harry Potter", IdImage = 10 } + ); + + modelBuilder.Entity().HasData( + new Commentary() { Id = 1, Comment = "Ce film est le meilleur", DateCommentary = new DateTime(2025,2,3), IdQuote = 1, IdUsers = 2 }, + new Commentary() { Id = 2, Comment = "Very good", DateCommentary = new DateTime(2025, 3, 11), IdQuote = 1, IdUsers = 3 } + ); + + modelBuilder.Entity().HasData( + new DailyQuote() { IdQuote = 1}, + new DailyQuote() { IdQuote = 5} + ); + + modelBuilder.Entity().HasData( + new Favorite() { IdQuote = 2, IdUsers = 8 }, + new Favorite() { IdQuote = 5, IdUsers = 3 }, + new Favorite() { IdQuote = 9, IdUsers = 1 }, + new Favorite() { IdQuote = 4, IdUsers = 10 }, + new Favorite() { IdQuote = 3, IdUsers = 2 }, + new Favorite() { IdQuote = 6, IdUsers = 7 }, + new Favorite() { IdQuote = 1, IdUsers = 6 }, + new Favorite() { IdQuote = 8, IdUsers = 9 }, + new Favorite() { IdQuote = 10, IdUsers = 5 } + ); modelBuilder.Entity().HasData( - new Images { Id = 1, ImgPath = "coucou" }, - new Images { Id = 2, ImgPath = "bonjour" } + new Images() { Id = 1 , ImgPath = "https://th.bing.com/th/id/OIP.TJuWNCsibz8MVmhdNQEdMwHaE8?w=244&h=180&c=7&r=0&o=5&pid=1.7" }, + new Images() { Id = 2 , ImgPath = "https://th.bing.com/th/id/OIP.NgXRQ5-IknA6_qOPFhLWIwHaHK?w=165&h=180&c=7&r=0&o=5&pid=1.7" }, + new Images() { Id = 3 , ImgPath = "https://th.bing.com/th/id/OIP.XcJoJ6bC9sAMjol1pJn5UQHaLH?w=118&h=180&c=7&r=0&o=5&pid=1.7" }, + new Images() { Id = 4 , ImgPath = "https://th.bing.com/th/id/OIP.PPIESqZaNDa-qUcfSDXhdQHaGK?w=210&h=180&c=7&r=0&o=5&pid=1.7" }, + new Images() { Id = 5 , ImgPath = "https://th.bing.com/th/id/OIP.XBghSl2kfRNNtQoSxc901wHaHa?w=177&h=180&c=7&r=0&o=5&pid=1.7" }, + new Images() { Id = 6 , ImgPath = "https://th.bing.com/th/id/OIP.af1Aid64cqEKoIOBgCPxtQHaJO?w=145&h=182&c=7&r=0&o=5&pid=1.7" }, + new Images() { Id = 7 , ImgPath = "https://th.bing.com/th/id/OIP.ri5vSXr5lNTLt4DO6KQXyQHaI4?w=158&h=189&c=7&r=0&o=5&pid=1.7" }, + new Images() { Id = 8 , ImgPath = "https://th.bing.com/th/id/OIP.uPTRLR8uspCiafiunUqKfQHaMJ?w=115&h=180&c=7&r=0&o=5&pid=1.7" }, + new Images() { Id = 9 , ImgPath = "https://th.bing.com/th/id/OIP.hcJis4rKbyQtugsoFJU2ngHaM_?w=118&h=207&c=7&r=0&o=5&pid=1.7" }, + new Images() { Id = 10 , ImgPath = "https://th.bing.com/th/id/OIP.Py1_XfUrKJY_A6tYEmFS5wHaE8?w=280&h=187&c=7&r=0&o=5&pid=1.7" } + ); + + modelBuilder.Entity().HasData( + new Question() { Id = 1, Text = "Qui est le leader de la Communauté de l'Anneau ?", AnswerA = "Gimli", AnswerB = "Aragorn", AnswerC = "Frodon", AnswerD = "Gandalf", CorrectAnswer = "B" }, + new Question() { Id = 2, Text = "Dans quelle maison Harry Potter est-il ?", AnswerA = "Serdaigle", AnswerB = "Gryffondor", AnswerC = "Serpentard", AnswerD = "Poufsouffle", CorrectAnswer = "B" }, + new Question() { Id = 3, Text = "Qui est le Seigneur des Ténèbres dans la saga 'Le Seigneur des Anneaux' ?", AnswerA = "Saroumane", AnswerB = "Sauron", AnswerC = "Gollum", AnswerD = "Gothmog", CorrectAnswer = "B" }, + new Question() { Id = 4, Text = "Dans le film 'Star Wars : Episode IV', qui sauve Luke Skywalker de l'Étoile de la Mort ?", AnswerA = "Han Solo", AnswerB = "Princesse Leia", AnswerC = "Chewbacca", AnswerD = "R2-D2", CorrectAnswer = "A" }, + new Question() { Id = 5, Text = "Qui est le souverain de Narnia dans 'Le Lion, la Sorcière Blanche et l'Armoire Magique' ?", AnswerA = "Reine Jadis", AnswerB = "Aslan", AnswerC = "Edmund", AnswerD = "Lucy", CorrectAnswer = "B" }, + new Question() { Id = 6, Text = "Quel est le nom du dragon dans 'Le Hobbit' ?", AnswerA = "Smaug", AnswerB = "Falkor", AnswerC = "Norbert", AnswerD = "Shenron", CorrectAnswer = "A" }, + new Question() { Id = 7, Text = "Qui est la première personne à être mordue par un vampire dans 'Twilight' ?", AnswerA = "Bella Swan", AnswerB = "Edward Cullen", AnswerC = "Jacob Black", AnswerD = "Victoria", CorrectAnswer = "A" }, + new Question() { Id = 8, Text = "Quel personnage dit 'Que la Force soit avec toi' dans 'Star Wars' ?", AnswerA = "Obi-Wan Kenobi", AnswerB = "Yoda", AnswerC = "Han Solo", AnswerD = "Luke Skywalker", CorrectAnswer = "A" }, + new Question() { Id = 9, Text = "Dans 'Jurassic Park', quel est le nom du paléontologue sur l'île ?", AnswerA = "Dr. Ellie Sattler", AnswerB = "Alan Grant", AnswerC = "John Hammond", AnswerD = "Dennis Nedry", CorrectAnswer = "B" }, + new Question() { Id = 10, Text = "Dans 'Game of Thrones', qui est surnommée la Mère des Dragons ?", AnswerA = "Cersei Lannister", AnswerB = "Arya Stark", AnswerC = "Daenerys Targaryen", AnswerD = "Sansa Stark", CorrectAnswer = "C" } ); + + modelBuilder.Entity().HasData( + new Quiz() { Id = 1, IdImage = 1, Title = "Quiz 1", NbQuestion = 5 }, + new Quiz() { Id = 1, IdImage = 2, Title = "Quiz 2", NbQuestion = 5 } + ); + + modelBuilder.Entity().HasData( + new QuizQuestion() { IdQuestion = 1, IdQuiz = 1 }, + new QuizQuestion() { IdQuestion = 2, IdQuiz = 1 }, + new QuizQuestion() { IdQuestion = 3, IdQuiz = 1 }, + new QuizQuestion() { IdQuestion = 4, IdQuiz = 1 }, + new QuizQuestion() { IdQuestion = 5, IdQuiz = 1 }, + new QuizQuestion() { IdQuestion = 6, IdQuiz = 2 }, + new QuizQuestion() { IdQuestion = 7, IdQuiz = 2 }, + new QuizQuestion() { IdQuestion = 8, IdQuiz = 2 }, + new QuizQuestion() { IdQuestion = 9, IdQuiz = 2 }, + new QuizQuestion() { IdQuestion = 10, IdQuiz = 2 } + ); + + modelBuilder.Entity().HasData( + new Quote() { Id = 1, Content = "Je n'y crois pas. Je n'y crois pas. Ce n'est pas possible", IdCharacter = 1, IdSource = 1, IdUsersPropose = 1 , IsValid = true, Langage = LangEnum.vf, Likes = 11025}, + new Quote() { Id = 1, Content = "There is always hope", IdCharacter = 2, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 }, + new Quote() { Id = 1, Content = "A red sun rises. Blood has been spilled this night.", IdCharacter = 3, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 } + ); + + modelBuilder.Entity().HasData( + new Source() { Id = 1, Title = "Jurassic Park", TypeSrc = TypeSrcEnum.movie, Year = 1993 }, + new Source() { Id = 2, Title = "Le Seigneur des anneaux : La Communauté de l'anneau", TypeSrc = TypeSrcEnum.movie, Year = 2001 }, + new Source() { Id = 3, Title = "Game of throne", TypeSrc = TypeSrcEnum.series, Year = 2011 }, + new Source() { Id = 4, Title = "Harry Potter à l'école des sorcier", TypeSrc = TypeSrcEnum.movie, Year = 1997 }, + new Source() { Id = 5, Title = "Star Wars, épisode IV : Un nouvel espoir", TypeSrc = TypeSrcEnum.movie, Year = 1977 } + ); + modelBuilder.Entity().HasData( - new Users { Id = 1, UserName = "Dev", Created = new DateTime(2000, 01, 01), Email = "dev@gmail.com", Password = "1234", IdImage = 1 }, - new Users { Id = 2, UserName = "Admin", Created = new DateTime(2000, 01, 01), Email = "admin@gmail.com", Password = "1234", IdImage = 1 } + new Users() { Id = 1, Email = "jhonDhoe@gmail.com", Password = "1234", Created = new DateTime(2025, 5, 12), UserName = "Jhon-Dhoe", IdImage = 1 }, + new Users() { Id = 2, Email = "lucy_rose@outlook.com", Password = "abcd", Created = new DateTime(2025, 3, 19), UserName = "Lucy-Rose", IdImage = 2 }, + new Users() { Id = 3, Email = "mark.taylor@yahoo.com", Password = "5678", Created = new DateTime(2024, 11, 2), UserName = "Mark-Taylor", IdImage = 3 }, + new Users() { Id = 4, Email = "sophie.martin@gmail.com", Password = "4321", Created = new DateTime(2025, 2, 28), UserName = "Sophie-Martin", IdImage = 4 }, + new Users() { Id = 5, Email = "nathan_doe@aol.com", Password = "8765", Created = new DateTime(2025, 1, 15), UserName = "Nathan-Doe", IdImage = 5 }, + new Users() { Id = 6, Email = "ella.brown@icloud.com", Password = "2468", Created = new DateTime(2025, 4, 7), UserName = "Ella-Brown", IdImage = 6 }, + new Users() { Id = 7, Email = "oliver_smith@gmail.com", Password = "1357", Created = new DateTime(2024, 12, 25), UserName = "Oliver-Smith", IdImage = 7 }, + new Users() { Id = 8, Email = "mia.jones@outlook.com", Password = "1122", Created = new DateTime(2025, 3, 5), UserName = "Mia-Jones", IdImage = 8 }, + new Users() { Id = 9, Email = "kevin_williams@aol.com", Password = "2233", Created = new DateTime(2025, 2, 22), UserName = "Kevin-Williams", IdImage = 9 }, + new Users() { Id = 10, Email = "olivia.white@yahoo.com", Password = "3344", Created = new DateTime(2025, 1, 3), UserName = "Olivia-White", IdImage = 10 } ); + + } } }