|
|
@ -56,25 +56,25 @@ class Program
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var athlete in db.AthletesSet)
|
|
|
|
foreach (var athlete in db.AthletesSet)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Accès à l'athlete d'id '2' :");
|
|
|
|
Console.WriteLine("Accès à l'athlete d'id '2' :");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.IdAthlete == 2))
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.Id == 2))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("Accès à l'athlete de username 'Doe' :");
|
|
|
|
Console.WriteLine("Accès à l'athlete de username 'Doe' :");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.Username == "Doe"))
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.UserName == "Doe"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
@ -83,7 +83,7 @@ class Program
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.Sexe == "F"))
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.Sexe == "F"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
@ -92,7 +92,7 @@ class Program
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.Email == "bruce.lee@example.com"))
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.Email == "bruce.lee@example.com"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
@ -101,7 +101,7 @@ class Program
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.Weight == 90))
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.Weight == 90))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
@ -110,7 +110,7 @@ class Program
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.Length == 1.80))
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.Length == 1.80))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
@ -119,7 +119,7 @@ class Program
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.DateOfBirth == new DateOnly(1990, 01, 01)))
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.DateOfBirth == new DateOnly(1990, 01, 01)))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
@ -128,7 +128,7 @@ class Program
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.LastName == "Martin"))
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.LastName == "Martin"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
@ -137,7 +137,7 @@ class Program
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.FirstName == "Anna"))
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.FirstName == "Anna"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
@ -146,7 +146,7 @@ class Program
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.LastName == "Brown" && a.FirstName == "Anna"))
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.LastName == "Brown" && a.FirstName == "Anna"))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
@ -155,7 +155,7 @@ class Program
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
Console.WriteLine("---------------------------------");
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.IsCoach == true))
|
|
|
|
foreach (var athlete in db.AthletesSet.Where(a => a.IsCoach == true))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
|
Console.WriteLine("---------------------------------\n");
|
|
|
@ -755,7 +755,7 @@ class Program
|
|
|
|
Console.WriteLine("Test d'ajout, de modification et de suppression des athletes :");
|
|
|
|
Console.WriteLine("Test d'ajout, de modification et de suppression des athletes :");
|
|
|
|
var picture = "https://davidalmeida.site/assets/me_avatar.f77af006.png";
|
|
|
|
var picture = "https://davidalmeida.site/assets/me_avatar.f77af006.png";
|
|
|
|
// Ajout d'un nouveau livre
|
|
|
|
// Ajout d'un nouveau livre
|
|
|
|
var newAthlete = new AthleteEntity { Username = "Doe", LastName = "Doe",ProfilPicture = picture,FirstName = "John", Email = "essaie.example.com", Password = "TheNewPassword", Sexe = "M", Length = 1.80, Weight = 90, DateOfBirth = new DateOnly(2024, 02, 22), IsCoach = false };
|
|
|
|
var newAthlete = new AthleteEntity { UserName = "Doe", LastName = "Doe",ProfilPicture = picture,FirstName = "John", Email = "essaie.example.com", PasswordHash = "TheNewPassword", Sexe = "M", Length = 1.80, Weight = 90, DateOfBirth = new DateOnly(2024, 02, 22), IsCoach = false };
|
|
|
|
db.AthletesSet.Add(newAthlete);
|
|
|
|
db.AthletesSet.Add(newAthlete);
|
|
|
|
db.SaveChanges();
|
|
|
|
db.SaveChanges();
|
|
|
|
|
|
|
|
|
|
|
@ -763,7 +763,7 @@ class Program
|
|
|
|
Console.WriteLine("Athlete après ajout :");
|
|
|
|
Console.WriteLine("Athlete après ajout :");
|
|
|
|
foreach (var athlete in db.AthletesSet)
|
|
|
|
foreach (var athlete in db.AthletesSet)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Modification du titre du nouveau livre
|
|
|
|
// Modification du titre du nouveau livre
|
|
|
@ -774,7 +774,7 @@ class Program
|
|
|
|
Console.WriteLine("Livres après modification :");
|
|
|
|
Console.WriteLine("Livres après modification :");
|
|
|
|
foreach (var athlete in db.AthletesSet)
|
|
|
|
foreach (var athlete in db.AthletesSet)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// Suppression du nouveau livre
|
|
|
|
// Suppression du nouveau livre
|
|
|
@ -785,7 +785,7 @@ class Program
|
|
|
|
Console.WriteLine("Livres après suppression :");
|
|
|
|
Console.WriteLine("Livres après suppression :");
|
|
|
|
foreach (var athlete in db.AthletesSet)
|
|
|
|
foreach (var athlete in db.AthletesSet)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
Console.WriteLine($"\t{athlete.IdAthlete} - {athlete.Username}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
Console.WriteLine($"\t{athlete.Id} - {athlete.UserName}, {athlete.LastName}, {athlete.FirstName}, {athlete.Email}, {athlete.Sexe}, {athlete.Length}, {athlete.Weight}, {athlete.DateOfBirth}, {athlete.IsCoach}");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|