|
|
|
@ -1,153 +1,150 @@
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Contextlib;
|
|
|
|
|
using Entity;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.Extensions.Hosting;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using Contextlib;
|
|
|
|
|
using Entity;
|
|
|
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
|
using Microsoft.Extensions.Options;
|
|
|
|
|
using Npgsql.EntityFrameworkCore.PostgreSQL;
|
|
|
|
|
|
|
|
|
|
namespace StubbedContextLib
|
|
|
|
|
{
|
|
|
|
|
public class StubWTFContext : WTFContext
|
|
|
|
|
{
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
|
|
|
|
|
|
/*modelBuilder.Entity<Admin>().HasData(
|
|
|
|
|
new Admin() { IdUsers = 1 }
|
|
|
|
|
);*/
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<Images>().HasData(
|
|
|
|
|
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<Users>().HasData(
|
|
|
|
|
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 }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<Character>().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<Quote>().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 = 2, Content = "There is always hope", IdCharacter = 2, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 3, Content = "A red sun rises. Blood has been spilled this night.", IdCharacter = 3, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 4, Content = "I wish the Ring had never come to me.I wish none of this had happened.", IdCharacter = 4, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 5, Content = "Dobby is a free elf!", IdCharacter = 5, IdSource = 4, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 6, Content = "Winter is comming", IdCharacter = 6, IdSource = 3, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 7, Content = "Je suis la dernière Targaryen. Je suis la reine des dragons", IdCharacter = 7, IdSource = 3, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 8, Content = "Je ne suis pas prêt à affronter ça. C'est trop pour moi.", IdCharacter = 8, IdSource = 5, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 9, Content = "Aidez-moi, Obi-Wan Kenobi, vous êtes mon seul espoir.", IdCharacter = 9, IdSource = 5, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 10, Content = "La quoi ?", IdCharacter = 10, IdSource = 4, IdUsersPropose = 1, IsValid = false, Langage = LangEnum.vf, Likes = 11025 }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<Commentary>().HasData(
|
|
|
|
|
new Commentary() { Id = 1, Comment = "Ce film est le meilleur", DateCommentary = new DateTime(2025,2,3), IdQuote = 1, IdUser = 2 },
|
|
|
|
|
new Commentary() { Id = 2, Comment = "Very good", DateCommentary = new DateTime(2025, 3, 11), IdQuote = 1, IdUser = 3 }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<Favorite>().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<Question>().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", IsValid = true },
|
|
|
|
|
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", IsValid = true },
|
|
|
|
|
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", IsValid = true },
|
|
|
|
|
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", IsValid = true },
|
|
|
|
|
new Question() { Id = 6, Text = "Quel est le nom du dragon dans Le Hobbit ?", AnswerA = "Smaug", AnswerB = "Falkor", AnswerC = "Norbert", AnswerD = "Shenron", CorrectAnswer = "A", IsValid = true },
|
|
|
|
|
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", IsValid = true },
|
|
|
|
|
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", IsValid = true },
|
|
|
|
|
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", IsValid = true },
|
|
|
|
|
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", IsValid = true }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<Quiz>().HasData(
|
|
|
|
|
new Quiz() { Id = 1, IdImage = 1, Title = "Quiz 1", NbQuestion = 5 },
|
|
|
|
|
new Quiz() { Id = 2, IdImage = 2, Title = "Quiz 2", NbQuestion = 5 }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<QuizQuestion>().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<Source>().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 }
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public StubWTFContext()
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
public StubWTFContext(DbContextOptions<WTFContext> options)
|
|
|
|
|
: base(options)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
|
|
|
|
{
|
|
|
|
|
if (!options.IsConfigured)
|
|
|
|
|
{
|
|
|
|
|
options.UseNpgsql("Host=WhatTheFantasy-wtf-api-test;Database=wtf-test;Username=test;Password=test;");
|
|
|
|
|
//options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Wf-Database.mdf;Trusted_Connection=True;");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
namespace StubbedContextLib
|
|
|
|
|
{
|
|
|
|
|
public class StubWTFContext : WTFContext
|
|
|
|
|
{
|
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
|
|
|
{
|
|
|
|
|
base.OnModelCreating(modelBuilder);
|
|
|
|
|
|
|
|
|
|
/*modelBuilder.Entity<Admin>().HasData(
|
|
|
|
|
new Admin() { IdUsers = 1 }
|
|
|
|
|
);*/
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<Images>().HasData(
|
|
|
|
|
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<Users>().HasData(
|
|
|
|
|
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 }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<Character>().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<Quote>().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 = 2, Content = "There is always hope", IdCharacter = 2, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 3, Content = "A red sun rises. Blood has been spilled this night.", IdCharacter = 3, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 4, Content = "I wish the Ring had never come to me.I wish none of this had happened.", IdCharacter = 4, IdSource = 2, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 5, Content = "Dobby is a free elf!", IdCharacter = 5, IdSource = 4, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 6, Content = "Winter is comming", IdCharacter = 6, IdSource = 3, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vo, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 7, Content = "Je suis la dernière Targaryen. Je suis la reine des dragons", IdCharacter = 7, IdSource = 3, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 8, Content = "Je ne suis pas prêt à affronter ça. C'est trop pour moi.", IdCharacter = 8, IdSource = 5, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 9, Content = "Aidez-moi, Obi-Wan Kenobi, vous êtes mon seul espoir.", IdCharacter = 9, IdSource = 5, IdUsersPropose = 1, IsValid = true, Langage = LangEnum.vf, Likes = 11025 },
|
|
|
|
|
new Quote() { Id = 10, Content = "La quoi ?", IdCharacter = 10, IdSource = 4, IdUsersPropose = 1, IsValid = false, Langage = LangEnum.vf, Likes = 11025 }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<Commentary>().HasData(
|
|
|
|
|
new Commentary() { Id = 1, Comment = "Ce film est le meilleur", DateCommentary = new DateTime(2025,2,3), IdQuote = 1, IdUser = 2 },
|
|
|
|
|
new Commentary() { Id = 2, Comment = "Very good", DateCommentary = new DateTime(2025, 3, 11), IdQuote = 1, IdUser = 3 }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<Favorite>().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<Question>().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", IsValid = true },
|
|
|
|
|
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", IsValid = true },
|
|
|
|
|
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", IsValid = true },
|
|
|
|
|
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", IsValid = true },
|
|
|
|
|
new Question() { Id = 6, Text = "Quel est le nom du dragon dans Le Hobbit ?", AnswerA = "Smaug", AnswerB = "Falkor", AnswerC = "Norbert", AnswerD = "Shenron", CorrectAnswer = "A", IsValid = true },
|
|
|
|
|
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", IsValid = true },
|
|
|
|
|
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", IsValid = true },
|
|
|
|
|
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", IsValid = true },
|
|
|
|
|
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", IsValid = true }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<Quiz>().HasData(
|
|
|
|
|
new Quiz() { Id = 1, IdImage = 1, Title = "Quiz 1", NbQuestion = 5 },
|
|
|
|
|
new Quiz() { Id = 2, IdImage = 2, Title = "Quiz 2", NbQuestion = 5 }
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
modelBuilder.Entity<QuizQuestion>().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<Source>().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 }
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public StubWTFContext()
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
public StubWTFContext(DbContextOptions<WTFContext> options)
|
|
|
|
|
: base(options)
|
|
|
|
|
{ }
|
|
|
|
|
|
|
|
|
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
|
|
|
|
{
|
|
|
|
|
if (!options.IsConfigured)
|
|
|
|
|
{
|
|
|
|
|
options.UseSqlServer(@"Server=(localdb)\mssqllocaldb;Database=Wf-Database.mdf;Trusted_Connection=True;");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|