From b3109d15412653c29dbb15f51945a9fdd4eb6432 Mon Sep 17 00:00:00 2001 From: Nestisse Date: Sat, 9 Mar 2024 09:12:01 +0100 Subject: [PATCH 1/6] Ajout du stub pour une enquete --- API_SQLuedo/EntityFramework/InquiryEntity.cs | 65 +++++++++---------- API_SQLuedo/EntityFramework/SolutionEntity.cs | 9 +++ .../StubbedContextLib/StubbedContext.cs | 21 +++++- 3 files changed, 60 insertions(+), 35 deletions(-) diff --git a/API_SQLuedo/EntityFramework/InquiryEntity.cs b/API_SQLuedo/EntityFramework/InquiryEntity.cs index f930acf..c77e521 100644 --- a/API_SQLuedo/EntityFramework/InquiryEntity.cs +++ b/API_SQLuedo/EntityFramework/InquiryEntity.cs @@ -1,39 +1,36 @@ -using System.ComponentModel.DataAnnotations; +namespace Entities; -namespace Entities +public class InquiryEntity { - public class InquiryEntity - { - public int Id { get; } - public string Title { get; set; } - public string Description { get; set; } - public bool IsUser { get; set; } - public InquiryTableEntity Database { get; set; } - public SolutionEntity InquiryTable { get; set; } - public InquiryEntity() { } + public int Id { get; } + public string Title { get; set; } + public string Description { get; set; } + public bool IsUser { get; set; } + public InquiryTableEntity Database { get; set; } + public SolutionEntity InquiryTable { get; set; } + public InquiryEntity() { } - public InquiryEntity(int id) - { - Id = id; - } - public InquiryEntity(int id, string title, string description, bool isUser, InquiryTableEntity database, SolutionEntity inquiryTable) - { - Id = id; - Title = title; - Description = description; - IsUser = isUser; - Database = database; - InquiryTable = inquiryTable; - } + public InquiryEntity(int id) + { + Id = id; + } + public InquiryEntity(int id, string title, string description, bool isUser, InquiryTableEntity database, SolutionEntity inquiryTable) + { + Id = id; + Title = title; + Description = description; + IsUser = isUser; + Database = database; + InquiryTable = inquiryTable; + } - public InquiryEntity(string title, string description, bool isUser, InquiryTableEntity database, SolutionEntity inquiryTable) - { - Id = 0; - Title = title; - Description = description; - IsUser = isUser; - Database = database; - InquiryTable = inquiryTable; - } + public InquiryEntity(string title, string description, bool isUser, InquiryTableEntity database, SolutionEntity inquiryTable) + { + Id = 0; + Title = title; + Description = description; + IsUser = isUser; + Database = database; + InquiryTable = inquiryTable; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/EntityFramework/SolutionEntity.cs b/API_SQLuedo/EntityFramework/SolutionEntity.cs index 6c8dbdf..c2aa1ee 100644 --- a/API_SQLuedo/EntityFramework/SolutionEntity.cs +++ b/API_SQLuedo/EntityFramework/SolutionEntity.cs @@ -41,4 +41,13 @@ public class SolutionEntity MurderWeapon = murderWeapon; Explanation = explanation; } + public SolutionEntity(int ownerId, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) + { + OwnerId = ownerId; + MurdererFirstName = murdererFirstName; + MurdererLastName = murdererLastName; + MurderPlace = murderPlace; + MurderWeapon = murderWeapon; + Explanation = explanation; + } } \ No newline at end of file diff --git a/API_SQLuedo/StubbedContextLib/StubbedContext.cs b/API_SQLuedo/StubbedContextLib/StubbedContext.cs index a833821..6745ede 100644 --- a/API_SQLuedo/StubbedContextLib/StubbedContext.cs +++ b/API_SQLuedo/StubbedContextLib/StubbedContext.cs @@ -1,4 +1,5 @@ -using System.Security.Cryptography; +using System.Runtime.CompilerServices; +using System.Security.Cryptography; using DbContextLib; using Entities; using Microsoft.AspNetCore.Cryptography.KeyDerivation; @@ -46,5 +47,23 @@ public class StubbedContext : UserDbContext prf: KeyDerivationPrf.HMACSHA256, iterationCount: 100000, numBytesRequested: 256 / 8)), "Victor.GABORIT@etu.uca.fr", true)); + + modelBuilder.Entity().HasData( + new InquiryEntity(1, "L'enquête de la carotte", "La description de l'inquiry1", true, null, null), + new InquiryEntity(2, "L'enquête sur les orang outan", "The new description", false, null, null), + new InquiryEntity(3, "L'enquête sur les parapluies", "Il pleuvait", false, null, null)); + + modelBuilder.Entity().HasData( + new InquiryTableEntity(1, "Inquiry1", + "Server=localhost;Database=Inquiry1;Trusted_Connection=True;MultipleActiveResultSets=true"), + new InquiryTableEntity(2, "Inquiry2", + "Server=localhost;Database=Inquiry2;Trusted_Connection=True;MultipleActiveResultSets=true"), + new InquiryTableEntity(3, "Inquiry3", + "Server=localhost;Database=Inquiry3;Trusted_Connection=True;MultipleActiveResultSets=true")); + + modelBuilder.Entity().HasData( + new SolutionEntity(1, "Maxime", "Sapountzis", "La cuisine", "Le couteau", "Parce que c'est Maxime"), + new SolutionEntity(2, "Johnny", "Ratton", "La cuisine", "Le couteau", "Parce que il est ra****"), + new SolutionEntity(3, "Erwan", "Menager", "La salle de bain", "L'arachide", "Parce que c'est Erwan")); } } \ No newline at end of file -- 2.36.3 From 3e4e96c7c94e1419ddccbe746f253a9dd4ff52e7 Mon Sep 17 00:00:00 2001 From: Nestisse Date: Sat, 9 Mar 2024 09:47:37 +0100 Subject: [PATCH 2/6] =?UTF-8?q?Ajout=20d'id=20pour=20r=C3=A9f=C3=A9rencer?= =?UTF-8?q?=20la=20solution=20et=20la=20base=20de=20donn=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API_SQLuedo/EntityFramework/InquiryEntity.cs | 25 +++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/API_SQLuedo/EntityFramework/InquiryEntity.cs b/API_SQLuedo/EntityFramework/InquiryEntity.cs index c77e521..3c43ee4 100644 --- a/API_SQLuedo/EntityFramework/InquiryEntity.cs +++ b/API_SQLuedo/EntityFramework/InquiryEntity.cs @@ -6,15 +6,22 @@ public class InquiryEntity public string Title { get; set; } public string Description { get; set; } public bool IsUser { get; set; } + public int IdDatabase { get; set; } public InquiryTableEntity Database { get; set; } + public int IdInquiryTable { get; set; } public SolutionEntity InquiryTable { get; set; } - public InquiryEntity() { } + + public InquiryEntity() + { + } public InquiryEntity(int id) { Id = id; } - public InquiryEntity(int id, string title, string description, bool isUser, InquiryTableEntity database, SolutionEntity inquiryTable) + + public InquiryEntity(int id, string title, string description, bool isUser, InquiryTableEntity database, + SolutionEntity inquiryTable) { Id = id; Title = title; @@ -24,7 +31,8 @@ public class InquiryEntity InquiryTable = inquiryTable; } - public InquiryEntity(string title, string description, bool isUser, InquiryTableEntity database, SolutionEntity inquiryTable) + public InquiryEntity(string title, string description, bool isUser, InquiryTableEntity database, + SolutionEntity inquiryTable) { Id = 0; Title = title; @@ -33,4 +41,15 @@ public class InquiryEntity Database = database; InquiryTable = inquiryTable; } + + public InquiryEntity(int id, string title, string description, bool isUser, int database, + int inquiryTable) + { + Id = id; + Title = title; + Description = description; + IsUser = isUser; + IdDatabase = database; + IdInquiryTable = inquiryTable; + } } \ No newline at end of file -- 2.36.3 From 7c88ef1b846ef2d457a850681e384f3f8b1d8de2 Mon Sep 17 00:00:00 2001 From: Nestisse Date: Sat, 9 Mar 2024 09:48:05 +0100 Subject: [PATCH 3/6] =?UTF-8?q?Modification=20du=20stub=20pour=20r=C3=A9f?= =?UTF-8?q?=C3=A9rencer=20explicitement=20les=20id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API_SQLuedo/StubbedContextLib/StubbedContext.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/API_SQLuedo/StubbedContextLib/StubbedContext.cs b/API_SQLuedo/StubbedContextLib/StubbedContext.cs index 6745ede..e87f12f 100644 --- a/API_SQLuedo/StubbedContextLib/StubbedContext.cs +++ b/API_SQLuedo/StubbedContextLib/StubbedContext.cs @@ -49,9 +49,9 @@ public class StubbedContext : UserDbContext numBytesRequested: 256 / 8)), "Victor.GABORIT@etu.uca.fr", true)); modelBuilder.Entity().HasData( - new InquiryEntity(1, "L'enquête de la carotte", "La description de l'inquiry1", true, null, null), - new InquiryEntity(2, "L'enquête sur les orang outan", "The new description", false, null, null), - new InquiryEntity(3, "L'enquête sur les parapluies", "Il pleuvait", false, null, null)); + new InquiryEntity(1, "L'enquête de la carotte", "La description de l'inquiry1", true, 1, 1), + new InquiryEntity(2, "L'enquête sur les orang outan", "The new description", false, 2, 2), + new InquiryEntity(3, "L'enquête sur les parapluies", "Il pleuvait", false, 3, 3)); modelBuilder.Entity().HasData( new InquiryTableEntity(1, "Inquiry1", -- 2.36.3 From 8b7a9d896543f7d83f5e7141c4d8322cd0d0b422 Mon Sep 17 00:00:00 2001 From: Nestisse Date: Sat, 9 Mar 2024 09:48:21 +0100 Subject: [PATCH 4/6] Ajout des tests sur les enquetes --- API_SQLuedo/TestConsoleEf/Program.cs | 143 +++++++++++++++++++++++++-- 1 file changed, 136 insertions(+), 7 deletions(-) diff --git a/API_SQLuedo/TestConsoleEf/Program.cs b/API_SQLuedo/TestConsoleEf/Program.cs index 380fe1e..33b60fa 100644 --- a/API_SQLuedo/TestConsoleEf/Program.cs +++ b/API_SQLuedo/TestConsoleEf/Program.cs @@ -4,7 +4,6 @@ using Entities; using Microsoft.AspNetCore.Cryptography.KeyDerivation; using Microsoft.Data.Sqlite; using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Logging; using StubbedContextLib; var connection = new SqliteConnection("DataSource=:memory:"); @@ -13,23 +12,23 @@ var options = new DbContextOptionsBuilder() .UseSqlite(connection) .Options; -using ILoggerFactory factory = new LoggerFactory(); +// Partie sur les utilisateurs using (var db = new StubbedContext(options)) { await db.Database.EnsureCreatedAsync(); - // Test sur les users + // Test sur les utilisateurs var users = db.Users; - // Affichage de tous les users + // Affichage de tous les utilisateurs Console.WriteLine("Affichage des noms des utilisateurs"); foreach (var user in users) { Console.WriteLine(user.Username); } - // Affichage des users filtrés + // Affichage des utilisateurs filtrés Console.WriteLine("\nAffichage des utilisateurs contenant e"); var filteredUsers = users.Where(u => u.Username.Contains("e")); foreach (var user in filteredUsers) @@ -37,7 +36,7 @@ using (var db = new StubbedContext(options)) Console.WriteLine(user.Username); } - // Affichage des users triés + // Affichage des utilisateurs triés Console.WriteLine("\nAffichage des utilisateurs triés selon leur nom"); var orderedUsers = users.OrderBy(u => u.Username); foreach (var user in orderedUsers) @@ -62,11 +61,13 @@ using (var db = new StubbedContext(options)) using (var db = new StubbedContext(options)) { + await db.Database.EnsureCreatedAsync(); + var users = db.Users; // Affichage du nouvel utilisateur Console.WriteLine("\nAffichage du nouvel utilisateur"); var u = await users.FirstOrDefaultAsync(u => u.Username == "le nouveau du groupe"); - foreach (var pptt in typeof(UserEntity).GetProperties().Where((p => p.CanWrite && p.Name != nameof(UserEntity.Id)))) + foreach (var pptt in typeof(UserEntity).GetProperties().Where(p => p.CanWrite && p.Name != nameof(UserEntity.Id))) { Console.WriteLine(pptt.GetValue(u)); } @@ -82,6 +83,8 @@ using (var db = new StubbedContext(options)) using (var db = new StubbedContext(options)) { + await db.Database.EnsureCreatedAsync(); + var users = db.Users; // Affichage des utilisateurs après suppression Console.WriteLine("\nAffichage des utilisateurs après suppression"); @@ -102,6 +105,8 @@ using (var db = new StubbedContext(options)) using (var db = new StubbedContext(options)) { + await db.Database.EnsureCreatedAsync(); + var users = db.Users; // Affichage des utilisateurs après modification var userToModify = await users.FirstOrDefaultAsync(u => u.Username == "clement modifié"); @@ -117,4 +122,128 @@ using (var db = new StubbedContext(options)) await db.SaveChangesAsync(); } } +} + +// Partie sur les enquetes +using (var db = new StubbedContext(options)) +{ + await db.Database.EnsureCreatedAsync(); + + // Test sur les enquetes + var inquiries = db.Inquiry; + + // Affichage de toutes les enquetes + Console.WriteLine("\nAffichage des noms des enquetes"); + foreach (var inquiry in inquiries) + { + Console.WriteLine(inquiry.Title); + } + + // Affichage des enquetes filtrées + Console.WriteLine("\nAffichage des enquetes contenant o"); + var filteredInquiries = inquiries.Where(i => i.Title.Contains("o")); + foreach (var inquiry in filteredInquiries) + { + Console.WriteLine(inquiry.Title); + } + + // Affichage des enquetes triées + Console.WriteLine("\nAffichage des enquetes triées selon leur nom"); + var orderedInquiries = inquiries.OrderBy(i => i.Title); + foreach (var inquiry in orderedInquiries) + { + Console.WriteLine(inquiry.Title); + } + + var fkoaf = db.Solutions; + + // Affichage de la solution de l'enquete sur les orang outan + Console.WriteLine("\nAffichage de la solution de l'enquete sur les orang outan"); + var inquirySolution = await inquiries.FirstOrDefaultAsync(i => i.Title == "L'enquête sur les orang outan"); + var i = inquirySolution.InquiryTable; + foreach (var pptt in typeof(SolutionEntity).GetProperties() + .Where(p => p.CanWrite && p.Name != nameof(SolutionEntity.Owner))) + { + Console.WriteLine(pptt.GetValue(i)); + } + + // Ajout d'une enquete + Console.WriteLine("\nAjout de la nouvelle enquete"); + var newInquiry = new InquiryEntity( + "La nouvelle enquete", + "La description de la nouvelle enquete", + true, + null, + null); + if (!inquiries.Any(inquiry => inquiry.Title == newInquiry.Title)) + { + inquiries.Add(newInquiry); + await db.SaveChangesAsync(); + } +} + +using (var db = new StubbedContext(options)) +{ + await db.Database.EnsureCreatedAsync(); + + var inquiries = db.Inquiry; + // Affichage de la nouvelle enquete + Console.WriteLine("\nAffichage de la nouvelle enquete"); + var i = await inquiries.FirstOrDefaultAsync(i => i.Title == "La nouvelle enquete"); + foreach (var pptt in typeof(InquiryEntity).GetProperties() + .Where(p => p.CanWrite && p.Name != nameof(InquiryEntity.Id))) + { + Console.WriteLine(pptt.GetValue(i)); + } + + if (i != null) + { + // Suppression de la nouvelle enquete + Console.WriteLine("\nSuppression de la nouvelle enquete"); + db.Inquiry.Remove(i); + await db.SaveChangesAsync(); + } +} + +using (var db = new StubbedContext(options)) +{ + await db.Database.EnsureCreatedAsync(); + + var inquiries = db.Inquiry; + // Affichage des utilisateurs après suppression + Console.WriteLine("\nAffichage des utilisateurs après suppression"); + foreach (var inquiry in inquiries) + { + Console.WriteLine(inquiry.Title); + } + + // Modification d'une enquete + Console.WriteLine("\nModification de l'enquete L'enquête de la carotte"); + var inquiryToModify = await inquiries.FirstOrDefaultAsync(i => i.Title == "L'enquête de la carotte"); + if (inquiryToModify != null) + { + inquiryToModify.Title = "L'enquête de la carotte modifiée"; + await db.SaveChangesAsync(); + } +} + +using (var db = new StubbedContext(options)) +{ + await db.Database.EnsureCreatedAsync(); + + var inquiries = db.Inquiry; + // Affichage des enquetes après modification + var inquiryToModify = await inquiries.FirstOrDefaultAsync(i => i.Title == "L'enquête de la carotte modifiée"); + if (inquiryToModify != null) + { + Console.WriteLine("\nAffichage de l'enquete après modification"); + Console.WriteLine(inquiryToModify.Title); + // Rollback + inquiryToModify = await inquiries.FirstOrDefaultAsync(i => i.Title == "L'enquête de la carotte modifiée"); + if (inquiryToModify != null) + { + inquiryToModify.Title = "L'enquête de la carotte"; + await db.SaveChangesAsync(); + } + } } \ No newline at end of file -- 2.36.3 From 8576c5515b67024a81c4d83912210024f7912ad0 Mon Sep 17 00:00:00 2001 From: Nestisse Date: Sun, 10 Mar 2024 11:08:53 +0100 Subject: [PATCH 5/6] Ajout de la partie solution --- API_SQLuedo/TestConsoleEf/Program.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/API_SQLuedo/TestConsoleEf/Program.cs b/API_SQLuedo/TestConsoleEf/Program.cs index 33b60fa..52c6063 100644 --- a/API_SQLuedo/TestConsoleEf/Program.cs +++ b/API_SQLuedo/TestConsoleEf/Program.cs @@ -155,10 +155,14 @@ using (var db = new StubbedContext(options)) Console.WriteLine(inquiry.Title); } - var fkoaf = db.Solutions; + var solutions = db.Solutions; // Affichage de la solution de l'enquete sur les orang outan Console.WriteLine("\nAffichage de la solution de l'enquete sur les orang outan"); + + var sol = await solutions.FirstOrDefaultAsync(s => s.Owner.Title == "L'enquête sur les orang outan"); + Console.WriteLine(sol.MurdererFirstName); + var inquirySolution = await inquiries.FirstOrDefaultAsync(i => i.Title == "L'enquête sur les orang outan"); var i = inquirySolution.InquiryTable; foreach (var pptt in typeof(SolutionEntity).GetProperties() -- 2.36.3 From a1876b108cb9a5da47ce6a97b4623dc90a452c0f Mon Sep 17 00:00:00 2001 From: Nestisse Date: Mon, 11 Mar 2024 09:50:07 +0100 Subject: [PATCH 6/6] =?UTF-8?q?Modification=20des=20classes=20Lesson,=20Co?= =?UTF-8?q?ntentLesson,=20Paragraph=20et=20ajout=20des=20namespaces=20sans?= =?UTF-8?q?=20la=20port=C3=A9e=20via=20les=20crochets?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- API_SQLuedo/DbContextLib/UserDbContext.cs | 1 - API_SQLuedo/Dto/BlackListDTO.cs | 21 ++++--- API_SQLuedo/Dto/ContentLessonDTO.cs | 23 ++++---- API_SQLuedo/Dto/InquiryDTO.cs | 37 ++++++------ API_SQLuedo/Dto/InquiryTableDTO.cs | 27 +++++---- API_SQLuedo/Dto/LessonDTO.cs | 44 +++++++------- API_SQLuedo/Dto/NotepadDTO.cs | 43 +++++++------- API_SQLuedo/Dto/ParagraphDTO.cs | 43 +++++--------- API_SQLuedo/Dto/SolutionDTO.cs | 53 +++++++++-------- API_SQLuedo/Dto/SuccessDTO.cs | 27 +++++---- API_SQLuedo/Dto/UserDTO.cs | 57 +++++++++---------- .../EntityFramework/ContentLessonEntity.cs | 39 +++++++++---- API_SQLuedo/EntityFramework/LessonEntity.cs | 7 +-- .../EntityFramework/ParagraphEntity.cs | 27 ++++----- API_SQLuedo/Model/BlackList.cs | 21 ++++--- API_SQLuedo/Model/ContentLesson.cs | 32 +++++++---- API_SQLuedo/Model/Inquiry.cs | 39 +++++++------ API_SQLuedo/Model/InquiryTable.cs | 29 +++++----- API_SQLuedo/Model/Lesson.cs | 48 +++++++--------- API_SQLuedo/Model/Notepad.cs | 43 +++++++------- API_SQLuedo/Model/Paragraph.cs | 53 +++++++---------- API_SQLuedo/Model/Solution.cs | 53 +++++++++-------- API_SQLuedo/Model/Success.cs | 27 +++++---- API_SQLuedo/Model/User.cs | 35 ++++++------ API_SQLuedo/Shared/Mapper/BlackListMapper.cs | 2 +- .../Shared/Mapper/ContentLessonMapper.cs | 34 ----------- API_SQLuedo/Shared/Mapper/InquiryMapper.cs | 2 +- .../Shared/Mapper/InquiryTableMapper.cs | 2 +- API_SQLuedo/Shared/Mapper/LessonMapper.cs | 2 +- API_SQLuedo/Shared/Mapper/NotepadMapper.cs | 2 +- API_SQLuedo/Shared/Mapper/ParagraphMapper.cs | 20 ++++--- API_SQLuedo/Shared/Mapper/SolutionMapper.cs | 2 +- API_SQLuedo/Shared/Mapper/SuccessMapper.cs | 2 +- API_SQLuedo/Shared/Mapper/UserMapper.cs | 2 +- 34 files changed, 419 insertions(+), 480 deletions(-) delete mode 100644 API_SQLuedo/Shared/Mapper/ContentLessonMapper.cs diff --git a/API_SQLuedo/DbContextLib/UserDbContext.cs b/API_SQLuedo/DbContextLib/UserDbContext.cs index 8be1c6f..6352ab8 100644 --- a/API_SQLuedo/DbContextLib/UserDbContext.cs +++ b/API_SQLuedo/DbContextLib/UserDbContext.cs @@ -30,7 +30,6 @@ namespace DbContextLib protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity().HasKey(c => c.LessonId); - modelBuilder.Entity().HasKey(c => c.LessonPartId); modelBuilder.Entity().HasKey(s => s.UserId); modelBuilder.Entity().HasKey(s => s.InquiryId); modelBuilder.Entity().HasKey(s => s.Id); diff --git a/API_SQLuedo/Dto/BlackListDTO.cs b/API_SQLuedo/Dto/BlackListDTO.cs index e614e70..913aaa0 100644 --- a/API_SQLuedo/Dto/BlackListDTO.cs +++ b/API_SQLuedo/Dto/BlackListDTO.cs @@ -1,14 +1,13 @@ -namespace Dto +namespace Dto; + +public class BlackListDTO { - public class BlackListDTO - { - public string Email { get; set; } - public DateOnly ExpirationDate { get; set; } + public string Email { get; set; } + public DateOnly ExpirationDate { get; set; } - public BlackListDTO(string email, DateOnly expirationDate) - { - Email = email; - ExpirationDate = expirationDate; - } + public BlackListDTO(string email, DateOnly expirationDate) + { + Email = email; + ExpirationDate = expirationDate; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Dto/ContentLessonDTO.cs b/API_SQLuedo/Dto/ContentLessonDTO.cs index ef844e7..778e428 100644 --- a/API_SQLuedo/Dto/ContentLessonDTO.cs +++ b/API_SQLuedo/Dto/ContentLessonDTO.cs @@ -1,14 +1,17 @@ -namespace Dto +namespace Dto; + +public abstract class ContentLessonDTO { - public class ContentLessonDTO - { - public int LessonId { get; set; } - public int LessonPartId { get; set; } + public int Id { get; set; } + public string ContentContent { get; set; } + public string ContentTitle { get; set; } + public int LessonId { get; set; } - public ContentLessonDTO(int lessonId, int lessonPartId) - { - LessonId = lessonId; - LessonPartId = lessonPartId; - } + protected ContentLessonDTO(int id, string contentContent, string contentTitle, int lessonId) + { + Id = id; + ContentContent = contentContent; + ContentTitle = contentTitle; + LessonId = lessonId; } } \ No newline at end of file diff --git a/API_SQLuedo/Dto/InquiryDTO.cs b/API_SQLuedo/Dto/InquiryDTO.cs index a1e438f..5b2ad10 100644 --- a/API_SQLuedo/Dto/InquiryDTO.cs +++ b/API_SQLuedo/Dto/InquiryDTO.cs @@ -1,26 +1,25 @@ -namespace Dto +namespace Dto; + +public class InquiryDTO { - public class InquiryDTO - { - public int Id { get;} + public int Id { get;} - public string Title { get; set; } + public string Title { get; set; } - public string Description { get; set; } + public string Description { get; set; } - public bool IsUser { get; set; } + public bool IsUser { get; set; } - public int Database { get; set; } - public int InquiryTable { get; set; } + public int Database { get; set; } + public int InquiryTable { get; set; } - public InquiryDTO(int id, string title, string description, bool isUser, int database, int inquiryTable) - { - Id = id; - Title = title; - Description = description; - IsUser = isUser; - Database = database; - InquiryTable = inquiryTable; - } + public InquiryDTO(int id, string title, string description, bool isUser, int database, int inquiryTable) + { + Id = id; + Title = title; + Description = description; + IsUser = isUser; + Database = database; + InquiryTable = inquiryTable; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Dto/InquiryTableDTO.cs b/API_SQLuedo/Dto/InquiryTableDTO.cs index ce28216..a636053 100644 --- a/API_SQLuedo/Dto/InquiryTableDTO.cs +++ b/API_SQLuedo/Dto/InquiryTableDTO.cs @@ -1,19 +1,18 @@ -namespace Dto +namespace Dto; + +public class InquiryTableDTO { - public class InquiryTableDTO - { - public int OwnerId { get; set; } - public string DatabaseName { get; set; } - public string ConnectionInfo { get; set; } + public int OwnerId { get; set; } + public string DatabaseName { get; set; } + public string ConnectionInfo { get; set; } - public InquiryTableDTO() { } + public InquiryTableDTO() { } - public InquiryTableDTO(int ownerId, string databaseName, string connectionInfo) - { - OwnerId = ownerId; - DatabaseName = databaseName; - ConnectionInfo = connectionInfo; - } + public InquiryTableDTO(int ownerId, string databaseName, string connectionInfo) + { + OwnerId = ownerId; + DatabaseName = databaseName; + ConnectionInfo = connectionInfo; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Dto/LessonDTO.cs b/API_SQLuedo/Dto/LessonDTO.cs index 70983ff..8e70b4f 100644 --- a/API_SQLuedo/Dto/LessonDTO.cs +++ b/API_SQLuedo/Dto/LessonDTO.cs @@ -1,26 +1,26 @@ -namespace Dto +namespace Dto; + +public class LessonDTO { - public class LessonDTO - { - public int Id { get; } - public string? Title { get; set; } - public string? LastPublisher { get; set; } - public DateOnly? LastEdit { get; set; } + public int Id { get; } + public string? Title { get; set; } + public string? LastPublisher { get; set; } + public DateOnly? LastEdit { get; set; } + public ICollection Content { get; set; } = new List(); - public LessonDTO() { } - public LessonDTO(int id, string title, string lastPublisher, DateOnly? lastEdit) - { - Id = id; - Title = title; - LastPublisher = lastPublisher; - LastEdit = lastEdit; - } + public LessonDTO() { } + public LessonDTO(int id, string title, string lastPublisher, DateOnly? lastEdit) + { + Id = id; + Title = title; + LastPublisher = lastPublisher; + LastEdit = lastEdit; + } - public LessonDTO(string title, string lastPublisher, DateOnly? lastEdit) - { - Title = title; - LastPublisher = lastPublisher; - LastEdit = lastEdit; - } + public LessonDTO(string title, string lastPublisher, DateOnly? lastEdit) + { + Title = title; + LastPublisher = lastPublisher; + LastEdit = lastEdit; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Dto/NotepadDTO.cs b/API_SQLuedo/Dto/NotepadDTO.cs index 3e86998..c49e155 100644 --- a/API_SQLuedo/Dto/NotepadDTO.cs +++ b/API_SQLuedo/Dto/NotepadDTO.cs @@ -1,26 +1,25 @@ -namespace Dto +namespace Dto; + +public class NotepadDTO { - public class NotepadDTO - { - public int Id { get; set; } - public int UserId { get; set; } - public int InquiryId { get; set; } - public string Notes { get; set; } + public int Id { get; set; } + public int UserId { get; set; } + public int InquiryId { get; set; } + public string Notes { get; set; } - public NotepadDTO() { } + public NotepadDTO() { } - public NotepadDTO(int id, int userId, int inquiryId, string notes) - { - Id = id; - UserId = userId; - InquiryId = inquiryId; - Notes = notes; - } - public NotepadDTO(int userId, int inquiryId, string notes) - { - UserId = userId; - InquiryId = inquiryId; - Notes = notes; - } + public NotepadDTO(int id, int userId, int inquiryId, string notes) + { + Id = id; + UserId = userId; + InquiryId = inquiryId; + Notes = notes; + } + public NotepadDTO(int userId, int inquiryId, string notes) + { + UserId = userId; + InquiryId = inquiryId; + Notes = notes; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Dto/ParagraphDTO.cs b/API_SQLuedo/Dto/ParagraphDTO.cs index c203c9c..1bb2016 100644 --- a/API_SQLuedo/Dto/ParagraphDTO.cs +++ b/API_SQLuedo/Dto/ParagraphDTO.cs @@ -1,32 +1,17 @@ -namespace Dto -{ - public class ParagraphDTO - { - public int Id { get; } - public string Title { get; set; } - public string Content { get; set; } - public string Info { get; set; } - public string Query { get; set; } - public string Comment { get; set; } +namespace Dto; - public ParagraphDTO() { } +public class ParagraphDTO : ContentLessonDTO +{ + public string Info { get; set; } + public string Query { get; set; } + public string Comment { get; set; } - public ParagraphDTO(int id, string title, string content, string info, string query, string comment) - { - Id = id; - Title = title; - Content = content; - Info = info; - Query = query; - Comment = comment; - } - public ParagraphDTO(string title, string content, string info, string query, string comment) - { - Title = title; - Content = content; - Info = info; - Query = query; - Comment = comment; - } + public ParagraphDTO(int id, string title, string content, string info, string query, string comment, int lessonId) : + base(id, content, + title, lessonId) + { + Info = info; + Query = query; + Comment = comment; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Dto/SolutionDTO.cs b/API_SQLuedo/Dto/SolutionDTO.cs index a775fd6..b13daf6 100644 --- a/API_SQLuedo/Dto/SolutionDTO.cs +++ b/API_SQLuedo/Dto/SolutionDTO.cs @@ -1,30 +1,29 @@ -namespace Dto +namespace Dto; + +public class SolutionDTO { - public class SolutionDTO + public int OwnerId { get; set; } + public string MurdererFirstName { get; set; } + public string MurdererLastName { get; set; } + public string MurderPlace { get; set; } + public string MurderWeapon { get; set; } + public string Explanation { get; set; } + public SolutionDTO() { } + public SolutionDTO(int ownerId, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) { - public int OwnerId { get; set; } - public string MurdererFirstName { get; set; } - public string MurdererLastName { get; set; } - public string MurderPlace { get; set; } - public string MurderWeapon { get; set; } - public string Explanation { get; set; } - public SolutionDTO() { } - public SolutionDTO(int ownerId, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) - { - OwnerId = ownerId; - MurdererFirstName = murdererFirstName; - MurdererLastName = murdererLastName; - MurderPlace = murderPlace; - MurderWeapon = murderWeapon; - Explanation = explanation; - } - public SolutionDTO(string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) - { - MurdererFirstName = murdererFirstName; - MurdererLastName = murdererLastName; - MurderPlace = murderPlace; - MurderWeapon = murderWeapon; - Explanation = explanation; - } + OwnerId = ownerId; + MurdererFirstName = murdererFirstName; + MurdererLastName = murdererLastName; + MurderPlace = murderPlace; + MurderWeapon = murderWeapon; + Explanation = explanation; } -} + public SolutionDTO(string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) + { + MurdererFirstName = murdererFirstName; + MurdererLastName = murdererLastName; + MurderPlace = murderPlace; + MurderWeapon = murderWeapon; + Explanation = explanation; + } +} \ No newline at end of file diff --git a/API_SQLuedo/Dto/SuccessDTO.cs b/API_SQLuedo/Dto/SuccessDTO.cs index ad3fcb3..87c26a3 100644 --- a/API_SQLuedo/Dto/SuccessDTO.cs +++ b/API_SQLuedo/Dto/SuccessDTO.cs @@ -1,18 +1,17 @@ -namespace Dto +namespace Dto; + +public class SuccessDTO { - public class SuccessDTO - { - public int UserId { get; set; } - public int InquiryId { get; set; } - public bool IsFinished { get; set; } + public int UserId { get; set; } + public int InquiryId { get; set; } + public bool IsFinished { get; set; } - public SuccessDTO() { } + public SuccessDTO() { } - public SuccessDTO(int userId, int inquiryId, bool isFinished) - { - UserId = userId; - InquiryId = inquiryId; - IsFinished = isFinished; - } + public SuccessDTO(int userId, int inquiryId, bool isFinished) + { + UserId = userId; + InquiryId = inquiryId; + IsFinished = isFinished; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Dto/UserDTO.cs b/API_SQLuedo/Dto/UserDTO.cs index 9a96905..b2553f5 100644 --- a/API_SQLuedo/Dto/UserDTO.cs +++ b/API_SQLuedo/Dto/UserDTO.cs @@ -1,34 +1,33 @@ -namespace Dto +namespace Dto; + +public class UserDTO { - public class UserDTO - { - public int Id { get; set; } - public string Username { get; set; } - public string Password { get; set; } - public string Email { get; set; } - public bool IsAdmin { get; set; } + public int Id { get; set; } + public string Username { get; set; } + public string Password { get; set; } + public string Email { get; set; } + public bool IsAdmin { get; set; } - public UserDTO() { } - public UserDTO(int id, string username, string password, string email, bool isAdmin) - { - Id = id; - Username = username; - Password = password; - Email = email; - IsAdmin = isAdmin; - } + public UserDTO() { } + public UserDTO(int id, string username, string password, string email, bool isAdmin) + { + Id = id; + Username = username; + Password = password; + Email = email; + IsAdmin = isAdmin; + } - public UserDTO(string username, string password, string email, bool isAdmin) - { - Username = username; - Password = password; - Email = email; - IsAdmin = isAdmin; - } + public UserDTO(string username, string password, string email, bool isAdmin) + { + Username = username; + Password = password; + Email = email; + IsAdmin = isAdmin; + } - public override string ToString() - { - return $"{Id}\t{Username}\t{Email}\t{IsAdmin}"; - } + public override string ToString() + { + return $"{Id}\t{Username}\t{Email}\t{IsAdmin}"; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/EntityFramework/ContentLessonEntity.cs b/API_SQLuedo/EntityFramework/ContentLessonEntity.cs index 067cc39..ee81947 100644 --- a/API_SQLuedo/EntityFramework/ContentLessonEntity.cs +++ b/API_SQLuedo/EntityFramework/ContentLessonEntity.cs @@ -3,22 +3,37 @@ namespace Entities; [Table("ContentLesson")] -public class ContentLessonEntity +public abstract class ContentLessonEntity { - [ForeignKey(nameof(Lesson))] - public int LessonId { get; set; } - public LessonEntity Lesson { get; set; } + public int Id { get; set; } + public string ContentContent { get; set; } + public string ContentTitle { get; set; } + [ForeignKey(nameof(Lesson))] public int LessonId { get; set; } + public LessonEntity Lesson { get; set; } = null!; - [ForeignKey(nameof(Paragraph))] - public int LessonPartId { get; set; } - public ParagraphEntity Paragraph { get; set; } + protected ContentLessonEntity() + { + } - public ContentLessonEntity(){} - public ContentLessonEntity(int lessonId, LessonEntity lesson, int lessonPartId, ParagraphEntity paragraph) + protected ContentLessonEntity(int id, string contentContent, string contentTitle) { + Id = id; + ContentContent = contentContent; + ContentTitle = contentTitle; + } + + + protected ContentLessonEntity(int id, int lessonId, string contentContent, string contentTitle) + { + Id = id; LessonId = lessonId; - Lesson = lesson; - LessonPartId = lessonPartId; - Paragraph = paragraph; + ContentContent = contentContent; + ContentTitle = contentTitle; + } + + protected ContentLessonEntity(string contentContent, string contentTitle) + { + ContentContent = contentContent; + ContentTitle = contentTitle; } } \ No newline at end of file diff --git a/API_SQLuedo/EntityFramework/LessonEntity.cs b/API_SQLuedo/EntityFramework/LessonEntity.cs index 2c345d3..b06f611 100644 --- a/API_SQLuedo/EntityFramework/LessonEntity.cs +++ b/API_SQLuedo/EntityFramework/LessonEntity.cs @@ -9,13 +9,8 @@ public class LessonEntity public string? Title { get; set; } public string? LastPublisher { get; set; } public DateOnly? LastEdit { get; set; } + public ICollection Content { get; set; } = new List(); - public LessonEntity() { } - - public LessonEntity(int id) - { - Id = id; - } public LessonEntity(int id, string title, string lastPublisher, DateOnly? lastEdit) { Id = id; diff --git a/API_SQLuedo/EntityFramework/ParagraphEntity.cs b/API_SQLuedo/EntityFramework/ParagraphEntity.cs index 4dc2277..ff1adc7 100644 --- a/API_SQLuedo/EntityFramework/ParagraphEntity.cs +++ b/API_SQLuedo/EntityFramework/ParagraphEntity.cs @@ -3,36 +3,31 @@ namespace Entities; [Table("Paragraph")] -public class ParagraphEntity +public class ParagraphEntity : ContentLessonEntity { - public int Id { get; set; } - public string Title { get; set; } - public string Content { get; set; } + // ID + // ContentContent + // ContentTitle + // LessonId public string Info { get; set; } public string Query { get; set; } public string Comment { get; set; } - public ParagraphEntity() { } - - - public ParagraphEntity(int id) + public ParagraphEntity() { - Id = id; } - public ParagraphEntity(int id, string title, string content, string info, string query, string comment) + public ParagraphEntity(int id, string title, string content, string info, string query, + string comment, int idLesson) : base(id, idLesson, content, title) { - Id = id; - Title = title; - Content = content; Info = info; Query = query; Comment = comment; } - public ParagraphEntity(string title, string content, string info, string query, string comment) + + public ParagraphEntity(string title, string content, string info, string query, string comment) : base(content, + title) { - Title = title; - Content = content; Info = info; Query = query; Comment = comment; diff --git a/API_SQLuedo/Model/BlackList.cs b/API_SQLuedo/Model/BlackList.cs index a53f1e9..002b5ba 100644 --- a/API_SQLuedo/Model/BlackList.cs +++ b/API_SQLuedo/Model/BlackList.cs @@ -1,14 +1,13 @@ -namespace ModelToEntities.Business +namespace Model; + +public class BlackList { - public class BlackList - { - public string Email { get; set; } - public DateOnly ExpirationDate { get; set; } + public string Email { get; set; } + public DateOnly ExpirationDate { get; set; } - public BlackList(string email, DateOnly expirationDate) - { - Email = email; - ExpirationDate = expirationDate; - } + public BlackList(string email, DateOnly expirationDate) + { + Email = email; + ExpirationDate = expirationDate; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Model/ContentLesson.cs b/API_SQLuedo/Model/ContentLesson.cs index 9ad8e3c..764d377 100644 --- a/API_SQLuedo/Model/ContentLesson.cs +++ b/API_SQLuedo/Model/ContentLesson.cs @@ -1,14 +1,24 @@ -namespace ModelToEntities.Business +namespace Model; + +public abstract class ContentLesson { - public class ContentLesson + public int Id { get; set; } + public string ContentContent { get; set; } + public string ContentTitle { get; set; } + + public int LessonId { get; set; } + + protected ContentLesson(string contentContent, string contentTitle) + { + ContentContent = contentContent; + ContentTitle = contentTitle; + } + + protected ContentLesson(int id, string contentContent, string contentTitle, int lessonId) { - public ContentLesson(int lessonId, int lessonPartId) - { - LessonId = lessonId; - LessonPartId = lessonPartId; - } - - public int LessonId { get; set; } - public int LessonPartId { get; set; } + Id = id; + ContentContent = contentContent; + ContentTitle = contentTitle; + LessonId = lessonId; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Model/Inquiry.cs b/API_SQLuedo/Model/Inquiry.cs index 05a23c2..8aab55a 100644 --- a/API_SQLuedo/Model/Inquiry.cs +++ b/API_SQLuedo/Model/Inquiry.cs @@ -1,24 +1,23 @@ -namespace ModelToEntities.Business +namespace Model; + +public class Inquiry { - public class Inquiry - { - public int Id { get; set; } - public string Title { get; set; } - public string Description { get; set; } - public bool IsUser { get; set; } - public int Database { get; set; } - public int InquiryTable { get; set; } + public int Id { get; set; } + public string Title { get; set; } + public string Description { get; set; } + public bool IsUser { get; set; } + public int Database { get; set; } + public int InquiryTable { get; set; } - public Inquiry() { } + public Inquiry() { } - public Inquiry(int id, string title, string description, bool isUser, int database, int inquiryTable) - { - Id = id; - Title = title; - Description = description; - IsUser = isUser; - Database = database; - InquiryTable = inquiryTable; - } + public Inquiry(int id, string title, string description, bool isUser, int database, int inquiryTable) + { + Id = id; + Title = title; + Description = description; + IsUser = isUser; + Database = database; + InquiryTable = inquiryTable; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Model/InquiryTable.cs b/API_SQLuedo/Model/InquiryTable.cs index e75b4fe..060702a 100644 --- a/API_SQLuedo/Model/InquiryTable.cs +++ b/API_SQLuedo/Model/InquiryTable.cs @@ -1,18 +1,17 @@ -namespace ModelToEntities.Business -{ - public class InquiryTable - { - public int OwnerId { get; set; } - public string DatabaseName { get; set; } - public string ConnectionInfo { get; set; } +namespace Model; - public InquiryTable() { } - public InquiryTable(int inquiryId, string databaseName, string connectionInfo) - { - OwnerId = inquiryId; - DatabaseName = databaseName; - ConnectionInfo = connectionInfo; - } +public class InquiryTable +{ + public int OwnerId { get; set; } + public string DatabaseName { get; set; } + public string ConnectionInfo { get; set; } + public InquiryTable() { } + public InquiryTable(int inquiryId, string databaseName, string connectionInfo) + { + OwnerId = inquiryId; + DatabaseName = databaseName; + ConnectionInfo = connectionInfo; } -} + +} \ No newline at end of file diff --git a/API_SQLuedo/Model/Lesson.cs b/API_SQLuedo/Model/Lesson.cs index 40f16aa..b9222d6 100644 --- a/API_SQLuedo/Model/Lesson.cs +++ b/API_SQLuedo/Model/Lesson.cs @@ -1,31 +1,25 @@ -namespace ModelToEntities.Business -{ - public class Lesson - { - public int Id { get; } - public string? Title { get; set; } - public string? LastPublisher { get; set; } - public DateOnly? LastEdit { get; set; } +namespace Model; - public Lesson() { } +public class Lesson +{ + public int Id { get; } + public string? Title { get; set; } + public string? LastPublisher { get; set; } + public DateOnly? LastEdit { get; set; } + public ICollection Content { get; set; } = new List(); - public Lesson(int id) - { - Id = id; - } - public Lesson(int id, string title, string lastPublisher, DateOnly? lastEdit) - { - Id = id; - Title = title; - LastPublisher = lastPublisher; - LastEdit = lastEdit; - } + public Lesson(int id, string title, string lastPublisher, DateOnly? lastEdit) + { + Id = id; + Title = title; + LastPublisher = lastPublisher; + LastEdit = lastEdit; + } - public Lesson(string title, string lastPublisher, DateOnly? lastEdit) - { - Title = title; - LastPublisher = lastPublisher; - LastEdit = lastEdit; - } + public Lesson(string title, string lastPublisher, DateOnly? lastEdit) + { + Title = title; + LastPublisher = lastPublisher; + LastEdit = lastEdit; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Model/Notepad.cs b/API_SQLuedo/Model/Notepad.cs index 7a36862..ce91168 100644 --- a/API_SQLuedo/Model/Notepad.cs +++ b/API_SQLuedo/Model/Notepad.cs @@ -1,26 +1,25 @@ -namespace ModelToEntities.Business +namespace Model; + +public class Notepad { - public class Notepad - { - public int Id { get; set; } - public int UserId { get; set; } - public int InquiryId { get; set; } - public string Notes { get; set; } + public int Id { get; set; } + public int UserId { get; set; } + public int InquiryId { get; set; } + public string Notes { get; set; } - public Notepad() { } + public Notepad() { } - public Notepad(int id, int userId, int inquiryId, string notes) - { - Id = id; - UserId = userId; - InquiryId = inquiryId; - Notes = notes; - } - public Notepad(int userId, int inquiryId, string notes) - { - UserId = userId; - InquiryId = inquiryId; - Notes = notes; - } + public Notepad(int id, int userId, int inquiryId, string notes) + { + Id = id; + UserId = userId; + InquiryId = inquiryId; + Notes = notes; + } + public Notepad(int userId, int inquiryId, string notes) + { + UserId = userId; + InquiryId = inquiryId; + Notes = notes; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Model/Paragraph.cs b/API_SQLuedo/Model/Paragraph.cs index 62585d8..583b37f 100644 --- a/API_SQLuedo/Model/Paragraph.cs +++ b/API_SQLuedo/Model/Paragraph.cs @@ -1,37 +1,24 @@ -namespace ModelToEntities.Business -{ - public class Paragraph - { - public int Id { get; } - public string? Title { get; set; } - public string? Content { get; set; } - public string? Info { get; set; } - public string? Query { get; set; } - public string? Comment { get; set; } +namespace Model; - public Paragraph() { } +public class Paragraph : ContentLesson +{ + public string Info { get; set; } + public string Query { get; set; } + public string Comment { get; set; } - public Paragraph(int id) - { - Id = id; - } + public Paragraph(string title, string content, string info, string query, string comment) : base(content, + title) + { + Info = info; + Query = query; + Comment = comment; + } - public Paragraph(int id, string title, string content, string info, string query, string comment) - { - Id = id; - Title = title; - Content = content; - Info = info; - Query = query; - Comment = comment; - } - public Paragraph(string title, string content, string info, string query, string comment) - { - Title = title; - Content = content; - Info = info; - Query = query; - Comment = comment; - } + public Paragraph(int id, string title, string content, string info, string query, string comment, int lessonId) : + base(id, content, title, lessonId) + { + Info = info; + Query = query; + Comment = comment; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Model/Solution.cs b/API_SQLuedo/Model/Solution.cs index fb17dca..bee801b 100644 --- a/API_SQLuedo/Model/Solution.cs +++ b/API_SQLuedo/Model/Solution.cs @@ -1,30 +1,29 @@ -namespace ModelToEntities.Business +namespace Model; + +public class Solution { - public class Solution + public int OwnerId { get; set; } + public string MurdererFirstName { get; set; } + public string MurdererLastName { get; set; } + public string MurderPlace { get; set; } + public string MurderWeapon { get; set; } + public string Explanation { get; set; } + public Solution() { } + public Solution(int ownerId, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) { - public int OwnerId { get; set; } - public string MurdererFirstName { get; set; } - public string MurdererLastName { get; set; } - public string MurderPlace { get; set; } - public string MurderWeapon { get; set; } - public string Explanation { get; set; } - public Solution() { } - public Solution(int ownerId, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) - { - OwnerId = ownerId; - MurdererFirstName = murdererFirstName; - MurdererLastName = murdererLastName; - MurderPlace = murderPlace; - MurderWeapon = murderWeapon; - Explanation = explanation; - } - public Solution(string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) - { - MurdererFirstName = murdererFirstName; - MurdererLastName = murdererLastName; - MurderPlace = murderPlace; - MurderWeapon = murderWeapon; - Explanation = explanation; - } + OwnerId = ownerId; + MurdererFirstName = murdererFirstName; + MurdererLastName = murdererLastName; + MurderPlace = murderPlace; + MurderWeapon = murderWeapon; + Explanation = explanation; } -} + public Solution(string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) + { + MurdererFirstName = murdererFirstName; + MurdererLastName = murdererLastName; + MurderPlace = murderPlace; + MurderWeapon = murderWeapon; + Explanation = explanation; + } +} \ No newline at end of file diff --git a/API_SQLuedo/Model/Success.cs b/API_SQLuedo/Model/Success.cs index 1fe54cf..1301b0f 100644 --- a/API_SQLuedo/Model/Success.cs +++ b/API_SQLuedo/Model/Success.cs @@ -1,18 +1,17 @@ -namespace ModelToEntities.Business +namespace Model; + +public class Success { - public class Success - { - public int UserId { get; set; } - public int InquiryId { get; set; } - public bool IsFinished { get; set; } + public int UserId { get; set; } + public int InquiryId { get; set; } + public bool IsFinished { get; set; } - public Success() { } + public Success() { } - public Success(int userId, int inquiryId, bool isFinished) - { - UserId = userId; - InquiryId = inquiryId; - IsFinished = isFinished; - } + public Success(int userId, int inquiryId, bool isFinished) + { + UserId = userId; + InquiryId = inquiryId; + IsFinished = isFinished; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Model/User.cs b/API_SQLuedo/Model/User.cs index 2ee4ce3..8031378 100644 --- a/API_SQLuedo/Model/User.cs +++ b/API_SQLuedo/Model/User.cs @@ -1,21 +1,20 @@ -namespace ModelToEntities.Business +namespace Model; + +public class User { - public class User - { - public int Id { get; set; } - public string Username { get; set; } - public string Password { get; set; } - public string Email { get; set; } - public bool IsAdmin { get; set; } + public int Id { get; set; } + public string Username { get; set; } + public string Password { get; set; } + public string Email { get; set; } + public bool IsAdmin { get; set; } - public User() { } - public User(int id, string username, string password, string email, bool isAdmin) - { - Id = id; - Username = username; - Password = password; - Email = email; - IsAdmin = isAdmin; - } + public User() { } + public User(int id, string username, string password, string email, bool isAdmin) + { + Id = id; + Username = username; + Password = password; + Email = email; + IsAdmin = isAdmin; } -} +} \ No newline at end of file diff --git a/API_SQLuedo/Shared/Mapper/BlackListMapper.cs b/API_SQLuedo/Shared/Mapper/BlackListMapper.cs index 945d823..18d99c3 100644 --- a/API_SQLuedo/Shared/Mapper/BlackListMapper.cs +++ b/API_SQLuedo/Shared/Mapper/BlackListMapper.cs @@ -1,6 +1,6 @@ using Dto; using Entities; -using ModelToEntities.Business; +using Model; namespace Shared.Mapper; diff --git a/API_SQLuedo/Shared/Mapper/ContentLessonMapper.cs b/API_SQLuedo/Shared/Mapper/ContentLessonMapper.cs deleted file mode 100644 index 1feb9a1..0000000 --- a/API_SQLuedo/Shared/Mapper/ContentLessonMapper.cs +++ /dev/null @@ -1,34 +0,0 @@ -using Dto; -using Entities; -using ModelToEntities.Business; - -namespace Shared.Mapper; - -public static class ContentLessonMapper -{ - public static ContentLesson FromDTOToModel(this ContentLessonDTO dto) - { - return new ContentLesson(dto.LessonId, dto.LessonPartId); - } - - public static ContentLesson FromEntityToModel(this ContentLessonEntity ent) - { - return new ContentLesson(ent.LessonId, ent.LessonPartId); - } - - public static ContentLessonDTO FromModelToDTO(this ContentLesson les) - { - return new ContentLessonDTO(les.LessonId, les.LessonPartId); - } - - public static ContentLessonDTO FromEntityToDTO(this ContentLessonEntity ent) - { - return new ContentLessonDTO(ent.LessonId, ent.LessonPartId); - } - - public static ContentLessonEntity FromModelToEntity(this ContentLesson les) - { - return new ContentLessonEntity(les.LessonId, new LessonEntity(les.LessonId), les.LessonPartId, - new ParagraphEntity(les.LessonPartId)); - } -} \ No newline at end of file diff --git a/API_SQLuedo/Shared/Mapper/InquiryMapper.cs b/API_SQLuedo/Shared/Mapper/InquiryMapper.cs index 7ade449..ace6105 100644 --- a/API_SQLuedo/Shared/Mapper/InquiryMapper.cs +++ b/API_SQLuedo/Shared/Mapper/InquiryMapper.cs @@ -1,6 +1,6 @@ using Dto; using Entities; -using ModelToEntities.Business; +using Model; namespace Shared.Mapper; diff --git a/API_SQLuedo/Shared/Mapper/InquiryTableMapper.cs b/API_SQLuedo/Shared/Mapper/InquiryTableMapper.cs index d5048a9..f11c4b8 100644 --- a/API_SQLuedo/Shared/Mapper/InquiryTableMapper.cs +++ b/API_SQLuedo/Shared/Mapper/InquiryTableMapper.cs @@ -1,6 +1,6 @@ using Dto; using Entities; -using ModelToEntities.Business; +using Model; namespace Shared.Mapper; diff --git a/API_SQLuedo/Shared/Mapper/LessonMapper.cs b/API_SQLuedo/Shared/Mapper/LessonMapper.cs index 9edf99f..824c592 100644 --- a/API_SQLuedo/Shared/Mapper/LessonMapper.cs +++ b/API_SQLuedo/Shared/Mapper/LessonMapper.cs @@ -1,6 +1,6 @@ using Dto; using Entities; -using ModelToEntities.Business; +using Model; namespace Shared.Mapper; diff --git a/API_SQLuedo/Shared/Mapper/NotepadMapper.cs b/API_SQLuedo/Shared/Mapper/NotepadMapper.cs index ba8aa08..5de18a8 100644 --- a/API_SQLuedo/Shared/Mapper/NotepadMapper.cs +++ b/API_SQLuedo/Shared/Mapper/NotepadMapper.cs @@ -1,6 +1,6 @@ using Dto; using Entities; -using ModelToEntities.Business; +using Model; namespace Shared.Mapper; diff --git a/API_SQLuedo/Shared/Mapper/ParagraphMapper.cs b/API_SQLuedo/Shared/Mapper/ParagraphMapper.cs index 0afa24d..8cdc29e 100644 --- a/API_SQLuedo/Shared/Mapper/ParagraphMapper.cs +++ b/API_SQLuedo/Shared/Mapper/ParagraphMapper.cs @@ -1,6 +1,6 @@ using Dto; using Entities; -using ModelToEntities.Business; +using Model; namespace Shared.Mapper; @@ -8,31 +8,35 @@ public static class ParagraphMapper { public static Paragraph FromDTOToModel(ParagraphDTO dto) { - return new Paragraph(dto.Id, dto.Title, dto.Content, dto.Info, dto.Query, dto.Comment); + return new Paragraph(dto.ContentTitle, dto.ContentContent, dto.Info, dto.Query, dto.Comment); } public static Paragraph FromEntityToModel(ParagraphEntity model) { - return new Paragraph(model.Id, model.Title, model.Content, model.Info, model.Query, model.Comment); + return new Paragraph(model.ContentTitle, model.ContentContent, model.Info, model.Query, model.Comment); } public static ParagraphDTO FromEntityToDTO(ParagraphEntity model) { - return new ParagraphDTO(model.Id, model.Title, model.Content, model.Info, model.Query, model.Comment); + return new ParagraphDTO(model.Id, model.ContentTitle, model.ContentContent, model.Info, model.Query, + model.Comment, model.LessonId); } public static ParagraphDTO FromModelToDTO(Paragraph model) { - return new ParagraphDTO(model.Id, model.Title, model.Content, model.Info, model.Query, model.Comment); + return new ParagraphDTO(model.Id, model.ContentTitle, model.ContentContent, model.Info, model.Query, + model.Comment, model.LessonId); } public static ParagraphEntity FromDTOToEntity(ParagraphDTO dto) { - return new ParagraphEntity(dto.Id, dto.Title, dto.Content, dto.Info, dto.Query, dto.Comment); + return new ParagraphEntity(dto.Id, dto.ContentTitle, dto.ContentContent, dto.Info, dto.Query, dto.Comment, + dto.LessonId); } - public static Paragraph FromModelToEntity(Paragraph model) + public static ParagraphEntity FromModelToEntity(Paragraph model) { - return new Paragraph(model.Id, model.Title, model.Content, model.Info, model.Query, model.Comment); + return new ParagraphEntity(model.Id, model.ContentTitle, model.ContentContent, model.Info, model.Query, + model.Comment, model.LessonId); } } \ No newline at end of file diff --git a/API_SQLuedo/Shared/Mapper/SolutionMapper.cs b/API_SQLuedo/Shared/Mapper/SolutionMapper.cs index 4d99120..098c56a 100644 --- a/API_SQLuedo/Shared/Mapper/SolutionMapper.cs +++ b/API_SQLuedo/Shared/Mapper/SolutionMapper.cs @@ -1,6 +1,6 @@ using Dto; using Entities; -using ModelToEntities.Business; +using Model; namespace Shared.Mapper; diff --git a/API_SQLuedo/Shared/Mapper/SuccessMapper.cs b/API_SQLuedo/Shared/Mapper/SuccessMapper.cs index a6d0261..ea5ef02 100644 --- a/API_SQLuedo/Shared/Mapper/SuccessMapper.cs +++ b/API_SQLuedo/Shared/Mapper/SuccessMapper.cs @@ -1,6 +1,6 @@ using Dto; using Entities; -using ModelToEntities.Business; +using Model; namespace Shared.Mapper; diff --git a/API_SQLuedo/Shared/Mapper/UserMapper.cs b/API_SQLuedo/Shared/Mapper/UserMapper.cs index a9d4350..f915699 100644 --- a/API_SQLuedo/Shared/Mapper/UserMapper.cs +++ b/API_SQLuedo/Shared/Mapper/UserMapper.cs @@ -1,6 +1,6 @@ using Dto; using Entities; -using ModelToEntities.Business; +using Model; namespace Shared.Mapper; -- 2.36.3