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;