Modification des classes Lesson, ContentLesson, Paragraph et ajout des namespaces sans la portée via les crochets
continuous-integration/drone/push Build is passing Details

pull/31/head
Clement CHIEU 1 year ago
parent 8576c5515b
commit a1876b108c

@ -30,7 +30,6 @@ namespace DbContextLib
protected override void OnModelCreating(ModelBuilder modelBuilder) protected override void OnModelCreating(ModelBuilder modelBuilder)
{ {
modelBuilder.Entity<ContentLessonEntity>().HasKey(c => c.LessonId); modelBuilder.Entity<ContentLessonEntity>().HasKey(c => c.LessonId);
modelBuilder.Entity<ContentLessonEntity>().HasKey(c => c.LessonPartId);
modelBuilder.Entity<SuccessEntity>().HasKey(s => s.UserId); modelBuilder.Entity<SuccessEntity>().HasKey(s => s.UserId);
modelBuilder.Entity<SuccessEntity>().HasKey(s => s.InquiryId); modelBuilder.Entity<SuccessEntity>().HasKey(s => s.InquiryId);
modelBuilder.Entity<InquiryEntity>().HasKey(s => s.Id); modelBuilder.Entity<InquiryEntity>().HasKey(s => s.Id);

@ -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) public BlackListDTO(string email, DateOnly expirationDate)
{ {
Email = email; Email = email;
ExpirationDate = expirationDate; ExpirationDate = expirationDate;
}
} }
} }

@ -1,14 +1,17 @@
namespace Dto namespace Dto;
public abstract class ContentLessonDTO
{ {
public class ContentLessonDTO public int Id { get; set; }
{ public string ContentContent { get; set; }
public int LessonId { get; set; } public string ContentTitle { get; set; }
public int LessonPartId { get; set; } public int LessonId { get; set; }
public ContentLessonDTO(int lessonId, int lessonPartId) protected ContentLessonDTO(int id, string contentContent, string contentTitle, int lessonId)
{ {
LessonId = lessonId; Id = id;
LessonPartId = lessonPartId; ContentContent = contentContent;
} ContentTitle = contentTitle;
LessonId = lessonId;
} }
} }

@ -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 Database { get; set; }
public int InquiryTable { get; set; } public int InquiryTable { get; set; }
public InquiryDTO(int id, string title, string description, bool isUser, int database, int inquiryTable) public InquiryDTO(int id, string title, string description, bool isUser, int database, int inquiryTable)
{ {
Id = id; Id = id;
Title = title; Title = title;
Description = description; Description = description;
IsUser = isUser; IsUser = isUser;
Database = database; Database = database;
InquiryTable = inquiryTable; InquiryTable = inquiryTable;
}
} }
} }

@ -1,19 +1,18 @@
namespace Dto namespace Dto;
public class InquiryTableDTO
{ {
public class InquiryTableDTO
{
public int OwnerId { get; set; } public int OwnerId { get; set; }
public string DatabaseName { get; set; } public string DatabaseName { get; set; }
public string ConnectionInfo { get; set; } public string ConnectionInfo { get; set; }
public InquiryTableDTO() { } public InquiryTableDTO() { }
public InquiryTableDTO(int ownerId, string databaseName, string connectionInfo) public InquiryTableDTO(int ownerId, string databaseName, string connectionInfo)
{ {
OwnerId = ownerId; OwnerId = ownerId;
DatabaseName = databaseName; DatabaseName = databaseName;
ConnectionInfo = connectionInfo; ConnectionInfo = connectionInfo;
}
} }
} }

@ -1,26 +1,26 @@
namespace Dto namespace Dto;
public class LessonDTO
{ {
public class LessonDTO public int Id { get; }
{ public string? Title { get; set; }
public int Id { get; } public string? LastPublisher { get; set; }
public string? Title { get; set; } public DateOnly? LastEdit { get; set; }
public string? LastPublisher { get; set; } public ICollection<ContentLessonDTO> Content { get; set; } = new List<ContentLessonDTO>();
public DateOnly? LastEdit { get; set; }
public LessonDTO() { } public LessonDTO() { }
public LessonDTO(int id, string title, string lastPublisher, DateOnly? lastEdit) public LessonDTO(int id, string title, string lastPublisher, DateOnly? lastEdit)
{ {
Id = id; Id = id;
Title = title; Title = title;
LastPublisher = lastPublisher; LastPublisher = lastPublisher;
LastEdit = lastEdit; LastEdit = lastEdit;
} }
public LessonDTO(string title, string lastPublisher, DateOnly? lastEdit) public LessonDTO(string title, string lastPublisher, DateOnly? lastEdit)
{ {
Title = title; Title = title;
LastPublisher = lastPublisher; LastPublisher = lastPublisher;
LastEdit = lastEdit; LastEdit = lastEdit;
}
} }
} }

@ -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 Id { get; set; } public int InquiryId { get; set; }
public int UserId { get; set; } public string Notes { 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) public NotepadDTO(int id, int userId, int inquiryId, string notes)
{ {
Id = id; Id = id;
UserId = userId; UserId = userId;
InquiryId = inquiryId; InquiryId = inquiryId;
Notes = notes; Notes = notes;
} }
public NotepadDTO(int userId, int inquiryId, string notes) public NotepadDTO(int userId, int inquiryId, string notes)
{ {
UserId = userId; UserId = userId;
InquiryId = inquiryId; InquiryId = inquiryId;
Notes = notes; Notes = notes;
}
} }
} }

@ -1,32 +1,17 @@
namespace Dto 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; }
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) public ParagraphDTO(int id, string title, string content, string info, string query, string comment, int lessonId) :
{ base(id, content,
Id = id; title, lessonId)
Title = title; {
Content = content; Info = info;
Info = info; Query = query;
Query = query; Comment = comment;
Comment = comment;
}
public ParagraphDTO(string title, string content, string info, string query, string comment)
{
Title = title;
Content = content;
Info = info;
Query = query;
Comment = comment;
}
} }
} }

@ -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; } OwnerId = ownerId;
public string MurdererFirstName { get; set; } MurdererFirstName = murdererFirstName;
public string MurdererLastName { get; set; } MurdererLastName = murdererLastName;
public string MurderPlace { get; set; } MurderPlace = murderPlace;
public string MurderWeapon { get; set; } MurderWeapon = murderWeapon;
public string Explanation { get; set; } Explanation = explanation;
public SolutionDTO() { } }
public SolutionDTO(int ownerId, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) public SolutionDTO(string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
{ {
OwnerId = ownerId; MurdererFirstName = murdererFirstName;
MurdererFirstName = murdererFirstName; MurdererLastName = murdererLastName;
MurdererLastName = murdererLastName; MurderPlace = murderPlace;
MurderPlace = murderPlace; MurderWeapon = murderWeapon;
MurderWeapon = murderWeapon; Explanation = explanation;
Explanation = explanation;
}
public SolutionDTO(string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
{
MurdererFirstName = murdererFirstName;
MurdererLastName = murdererLastName;
MurderPlace = murderPlace;
MurderWeapon = murderWeapon;
Explanation = explanation;
}
} }
} }

@ -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 int UserId { get; set; } public bool IsFinished { get; set; }
public int InquiryId { get; set; }
public bool IsFinished { get; set; }
public SuccessDTO() { } public SuccessDTO() { }
public SuccessDTO(int userId, int inquiryId, bool isFinished) public SuccessDTO(int userId, int inquiryId, bool isFinished)
{ {
UserId = userId; UserId = userId;
InquiryId = inquiryId; InquiryId = inquiryId;
IsFinished = isFinished; IsFinished = isFinished;
}
} }
} }

@ -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 int Id { get; set; } public string Password { get; set; }
public string Username { get; set; } public string Email { get; set; }
public string Password { get; set; } public bool IsAdmin { get; set; }
public string Email { get; set; }
public bool IsAdmin { get; set; }
public UserDTO() { } public UserDTO() { }
public UserDTO(int id, string username, string password, string email, bool isAdmin) public UserDTO(int id, string username, string password, string email, bool isAdmin)
{ {
Id = id; Id = id;
Username = username; Username = username;
Password = password; Password = password;
Email = email; Email = email;
IsAdmin = isAdmin; IsAdmin = isAdmin;
} }
public UserDTO(string username, string password, string email, bool isAdmin) public UserDTO(string username, string password, string email, bool isAdmin)
{ {
Username = username; Username = username;
Password = password; Password = password;
Email = email; Email = email;
IsAdmin = isAdmin; IsAdmin = isAdmin;
} }
public override string ToString() public override string ToString()
{ {
return $"{Id}\t{Username}\t{Email}\t{IsAdmin}"; return $"{Id}\t{Username}\t{Email}\t{IsAdmin}";
}
} }
} }

@ -3,22 +3,37 @@
namespace Entities; namespace Entities;
[Table("ContentLesson")] [Table("ContentLesson")]
public class ContentLessonEntity public abstract class ContentLessonEntity
{ {
[ForeignKey(nameof(Lesson))] public int Id { get; set; }
public int LessonId { get; set; } public string ContentContent { get; set; }
public LessonEntity Lesson { get; set; } public string ContentTitle { get; set; }
[ForeignKey(nameof(Lesson))] public int LessonId { get; set; }
public LessonEntity Lesson { get; set; } = null!;
[ForeignKey(nameof(Paragraph))] protected ContentLessonEntity()
public int LessonPartId { get; set; } {
public ParagraphEntity Paragraph { get; set; } }
public ContentLessonEntity(){} protected ContentLessonEntity(int id, string contentContent, string contentTitle)
public ContentLessonEntity(int lessonId, LessonEntity lesson, int lessonPartId, ParagraphEntity paragraph)
{ {
Id = id;
ContentContent = contentContent;
ContentTitle = contentTitle;
}
protected ContentLessonEntity(int id, int lessonId, string contentContent, string contentTitle)
{
Id = id;
LessonId = lessonId; LessonId = lessonId;
Lesson = lesson; ContentContent = contentContent;
LessonPartId = lessonPartId; ContentTitle = contentTitle;
Paragraph = paragraph; }
protected ContentLessonEntity(string contentContent, string contentTitle)
{
ContentContent = contentContent;
ContentTitle = contentTitle;
} }
} }

@ -9,13 +9,8 @@ public class LessonEntity
public string? Title { get; set; } public string? Title { get; set; }
public string? LastPublisher { get; set; } public string? LastPublisher { get; set; }
public DateOnly? LastEdit { get; set; } public DateOnly? LastEdit { get; set; }
public ICollection<ContentLessonEntity> Content { get; set; } = new List<ContentLessonEntity>();
public LessonEntity() { }
public LessonEntity(int id)
{
Id = id;
}
public LessonEntity(int id, string title, string lastPublisher, DateOnly? lastEdit) public LessonEntity(int id, string title, string lastPublisher, DateOnly? lastEdit)
{ {
Id = id; Id = id;

@ -3,36 +3,31 @@
namespace Entities; namespace Entities;
[Table("Paragraph")] [Table("Paragraph")]
public class ParagraphEntity public class ParagraphEntity : ContentLessonEntity
{ {
public int Id { get; set; } // ID
public string Title { get; set; } // ContentContent
public string Content { get; set; } // ContentTitle
// LessonId
public string Info { get; set; } public string Info { get; set; }
public string Query { get; set; } public string Query { get; set; }
public string Comment { get; set; } public string Comment { get; set; }
public ParagraphEntity() { } public ParagraphEntity()
public ParagraphEntity(int id)
{ {
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; Info = info;
Query = query; Query = query;
Comment = comment; 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; Info = info;
Query = query; Query = query;
Comment = comment; Comment = comment;

@ -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) public BlackList(string email, DateOnly expirationDate)
{ {
Email = email; Email = email;
ExpirationDate = expirationDate; ExpirationDate = expirationDate;
}
} }
} }

@ -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) Id = id;
{ ContentContent = contentContent;
LessonId = lessonId; ContentTitle = contentTitle;
LessonPartId = lessonPartId; LessonId = lessonId;
}
public int LessonId { get; set; }
public int LessonPartId { get; set; }
} }
} }

@ -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 int Id { get; set; } public string Description { get; set; }
public string Title { get; set; } public bool IsUser { get; set; }
public string Description { get; set; } public int Database { get; set; }
public bool IsUser { get; set; } public int InquiryTable { 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) public Inquiry(int id, string title, string description, bool isUser, int database, int inquiryTable)
{ {
Id = id; Id = id;
Title = title; Title = title;
Description = description; Description = description;
IsUser = isUser; IsUser = isUser;
Database = database; Database = database;
InquiryTable = inquiryTable; InquiryTable = inquiryTable;
}
} }
} }

@ -1,18 +1,17 @@
namespace ModelToEntities.Business namespace Model;
{
public class InquiryTable
{
public int OwnerId { get; set; }
public string DatabaseName { get; set; }
public string ConnectionInfo { get; set; }
public InquiryTable() { } public class InquiryTable
public InquiryTable(int inquiryId, string databaseName, string connectionInfo) {
{ public int OwnerId { get; set; }
OwnerId = inquiryId; public string DatabaseName { get; set; }
DatabaseName = databaseName; public string ConnectionInfo { get; set; }
ConnectionInfo = connectionInfo;
}
public InquiryTable() { }
public InquiryTable(int inquiryId, string databaseName, string connectionInfo)
{
OwnerId = inquiryId;
DatabaseName = databaseName;
ConnectionInfo = connectionInfo;
} }
} }

@ -1,31 +1,25 @@
namespace ModelToEntities.Business namespace Model;
{
public class Lesson
{
public int Id { get; }
public string? Title { get; set; }
public string? LastPublisher { get; set; }
public DateOnly? LastEdit { get; set; }
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<ContentLesson> Content { get; set; } = new List<ContentLesson>();
public Lesson(int id) public Lesson(int id, string title, string lastPublisher, DateOnly? lastEdit)
{ {
Id = id; Id = id;
} Title = title;
public Lesson(int id, string title, string lastPublisher, DateOnly? lastEdit) LastPublisher = lastPublisher;
{ LastEdit = lastEdit;
Id = id; }
Title = title;
LastPublisher = lastPublisher;
LastEdit = lastEdit;
}
public Lesson(string title, string lastPublisher, DateOnly? lastEdit) public Lesson(string title, string lastPublisher, DateOnly? lastEdit)
{ {
Title = title; Title = title;
LastPublisher = lastPublisher; LastPublisher = lastPublisher;
LastEdit = lastEdit; LastEdit = lastEdit;
}
} }
} }

@ -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 Id { get; set; } public int InquiryId { get; set; }
public int UserId { get; set; } public string Notes { 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) public Notepad(int id, int userId, int inquiryId, string notes)
{ {
Id = id; Id = id;
UserId = userId; UserId = userId;
InquiryId = inquiryId; InquiryId = inquiryId;
Notes = notes; Notes = notes;
} }
public Notepad(int userId, int inquiryId, string notes) public Notepad(int userId, int inquiryId, string notes)
{ {
UserId = userId; UserId = userId;
InquiryId = inquiryId; InquiryId = inquiryId;
Notes = notes; Notes = notes;
}
} }
} }

@ -1,37 +1,24 @@
namespace ModelToEntities.Business namespace Model;
{
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; }
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) public Paragraph(string title, string content, string info, string query, string comment) : base(content,
{ title)
Id = id; {
} Info = info;
Query = query;
Comment = comment;
}
public Paragraph(int id, string title, string content, string info, string query, string comment) public Paragraph(int id, string title, string content, string info, string query, string comment, int lessonId) :
{ base(id, content, title, lessonId)
Id = id; {
Title = title; Info = info;
Content = content; Query = query;
Info = info; Comment = comment;
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;
}
} }
} }

@ -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; } OwnerId = ownerId;
public string MurdererFirstName { get; set; } MurdererFirstName = murdererFirstName;
public string MurdererLastName { get; set; } MurdererLastName = murdererLastName;
public string MurderPlace { get; set; } MurderPlace = murderPlace;
public string MurderWeapon { get; set; } MurderWeapon = murderWeapon;
public string Explanation { get; set; } Explanation = explanation;
public Solution() { } }
public Solution(int ownerId, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation) public Solution(string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
{ {
OwnerId = ownerId; MurdererFirstName = murdererFirstName;
MurdererFirstName = murdererFirstName; MurdererLastName = murdererLastName;
MurdererLastName = murdererLastName; MurderPlace = murderPlace;
MurderPlace = murderPlace; MurderWeapon = murderWeapon;
MurderWeapon = murderWeapon; Explanation = explanation;
Explanation = explanation;
}
public Solution(string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
{
MurdererFirstName = murdererFirstName;
MurdererLastName = murdererLastName;
MurderPlace = murderPlace;
MurderWeapon = murderWeapon;
Explanation = explanation;
}
} }
} }

@ -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 int UserId { get; set; } public bool IsFinished { get; set; }
public int InquiryId { get; set; }
public bool IsFinished { get; set; }
public Success() { } public Success() { }
public Success(int userId, int inquiryId, bool isFinished) public Success(int userId, int inquiryId, bool isFinished)
{ {
UserId = userId; UserId = userId;
InquiryId = inquiryId; InquiryId = inquiryId;
IsFinished = isFinished; IsFinished = isFinished;
}
} }
} }

@ -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 int Id { get; set; } public string Password { get; set; }
public string Username { get; set; } public string Email { get; set; }
public string Password { get; set; } public bool IsAdmin { get; set; }
public string Email { get; set; }
public bool IsAdmin { get; set; }
public User() { } public User() { }
public User(int id, string username, string password, string email, bool isAdmin) public User(int id, string username, string password, string email, bool isAdmin)
{ {
Id = id; Id = id;
Username = username; Username = username;
Password = password; Password = password;
Email = email; Email = email;
IsAdmin = isAdmin; IsAdmin = isAdmin;
}
} }
} }

@ -1,6 +1,6 @@
using Dto; using Dto;
using Entities; using Entities;
using ModelToEntities.Business; using Model;
namespace Shared.Mapper; namespace Shared.Mapper;

@ -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));
}
}

@ -1,6 +1,6 @@
using Dto; using Dto;
using Entities; using Entities;
using ModelToEntities.Business; using Model;
namespace Shared.Mapper; namespace Shared.Mapper;

@ -1,6 +1,6 @@
using Dto; using Dto;
using Entities; using Entities;
using ModelToEntities.Business; using Model;
namespace Shared.Mapper; namespace Shared.Mapper;

@ -1,6 +1,6 @@
using Dto; using Dto;
using Entities; using Entities;
using ModelToEntities.Business; using Model;
namespace Shared.Mapper; namespace Shared.Mapper;

@ -1,6 +1,6 @@
using Dto; using Dto;
using Entities; using Entities;
using ModelToEntities.Business; using Model;
namespace Shared.Mapper; namespace Shared.Mapper;

@ -1,6 +1,6 @@
using Dto; using Dto;
using Entities; using Entities;
using ModelToEntities.Business; using Model;
namespace Shared.Mapper; namespace Shared.Mapper;
@ -8,31 +8,35 @@ public static class ParagraphMapper
{ {
public static Paragraph FromDTOToModel(ParagraphDTO dto) 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) 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) 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) 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) 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);
} }
} }

@ -1,6 +1,6 @@
using Dto; using Dto;
using Entities; using Entities;
using ModelToEntities.Business; using Model;
namespace Shared.Mapper; namespace Shared.Mapper;

@ -1,6 +1,6 @@
using Dto; using Dto;
using Entities; using Entities;
using ModelToEntities.Business; using Model;
namespace Shared.Mapper; namespace Shared.Mapper;

@ -1,6 +1,6 @@
using Dto; using Dto;
using Entities; using Entities;
using ModelToEntities.Business; using Model;
namespace Shared.Mapper; namespace Shared.Mapper;

Loading…
Cancel
Save