Ajout de tous des mappers correspondant à chaque classe+ Ajout de constructeur nécessaire à la transformation + Suppression des propriétés de navigation dans les DTO et les Business classes.

pull/26/head
Maxime SAPOUNTZIS 1 year ago
parent 9a7c101351
commit 0c936e14ec

@ -18,5 +18,14 @@ namespace Entities.SQLuedoDB
[ForeignKey(nameof(Paragraph))]
public int LessonPartId { get; set; }
public ParagraphEntity Paragraph { get; set; }
public ContentLessonEntity(){}
public ContentLessonEntity(int lessonId, LessonEntity lesson, int lessonPartId, ParagraphEntity paragraph)
{
LessonId = lessonId;
Lesson = lesson;
LessonPartId = lessonPartId;
Paragraph = paragraph;
}
}
}

@ -16,6 +16,10 @@ namespace Entities.SQLuedoDB
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;

@ -15,6 +15,11 @@ namespace Entities.SQLuedoDB
public string ConnectionInfo { get; set; }
public InquiryTableEntity() { }
public InquiryTableEntity(int inquiryId)
{
OwnerId = inquiryId;
}
public InquiryTableEntity(int inquiryId, string databaseName, string connectionInfo)
{
OwnerId = inquiryId;

@ -9,12 +9,17 @@ namespace Entities.SQLuedoDB
public class LessonEntity
{
public int Id { get; set; }
public string Title { get; set; }
public string LastPublisher { get; set; }
public DateOnly LastEdit { get; set; }
public string? Title { get; set; }
public string? LastPublisher { get; set; }
public DateOnly? LastEdit { get; set; }
public LessonEntity() { }
public LessonEntity(int id, string title, string lastPublisher, DateOnly lastEdit)
public LessonEntity(int id)
{
Id = id;
}
public LessonEntity(int id, string title, string lastPublisher, DateOnly? lastEdit)
{
Id = id;
Title = title;
@ -22,7 +27,7 @@ namespace Entities.SQLuedoDB
LastEdit = lastEdit;
}
public LessonEntity(string title, string lastPublisher, DateOnly lastEdit)
public LessonEntity(string title, string lastPublisher, DateOnly? lastEdit)
{
Title = title;
LastPublisher = lastPublisher;

@ -11,6 +11,12 @@
public ParagraphEntity() { }
public ParagraphEntity(int id)
{
Id = id;
}
public ParagraphEntity(int id, string title, string content, string info, string query, string comment)
{
Id = id;

@ -11,14 +11,18 @@ namespace Entities.SQLuedoDB
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
[Required]
public int OwnerId { get; set; }
public InquiryEntity Owner { 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 InquiryEntity? Owner { 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 SolutionEntity() { }
public SolutionEntity(int ownerId, InquiryEntity owner, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
public SolutionEntity(int ownerId)
{
OwnerId = ownerId;
}
public SolutionEntity(int ownerId, InquiryEntity? owner, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
{
OwnerId = ownerId;
Owner = owner;
@ -28,7 +32,7 @@ namespace Entities.SQLuedoDB
MurderWeapon = murderWeapon;
Explanation = explanation;
}
public SolutionEntity(InquiryEntity owner, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
public SolutionEntity(InquiryEntity? owner, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
{
Owner = owner;
MurdererFirstName = murdererFirstName;

@ -21,6 +21,15 @@ namespace Entities.SQLuedoDB
public SuccessEntity() { }
public SuccessEntity(int userId, UserEntity user, int inquiryId, InquiryEntity inquiry, bool isFinished)
{
UserId = userId;
User = user;
InquiryId = inquiryId;
Inquiry = inquiry;
IsFinished = isFinished;
}
public SuccessEntity(int userId, int inquiryId, bool isFinished)
{
UserId = userId;

@ -13,6 +13,11 @@ namespace Entities.SQLuedoDB
public UserEntity() { }
public UserEntity(int id)
{
Id = id;
}
public UserEntity(int id, string username, string password, string email, bool isAdmin)
{
Id = id;

@ -0,0 +1,22 @@
using Entities.SQLuedoDB;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model.Business
{
public class ContentLesson
{
public ContentLesson(int lessonId, int lessonPartId)
{
LessonId = lessonId;
LessonPartId = lessonPartId;
}
public int LessonId { get; set; }
public int LessonPartId { get; set; }
}
}

@ -1,4 +1,4 @@
using Entities.SQLudeoDB;
using Entities.SQLuedoDB;
using System;
using System.Collections.Generic;
using System.Globalization;
@ -14,12 +14,12 @@ namespace Model.Business
public string Title { get; set; }
public string Description { get; set; }
public bool IsUser { get; set; }
public InquiryTable Database { get; set; }
public Solution InquiryTable { get; set; }
public int Database { get; set; }
public int InquiryTable { get; set; }
public Inquiry() { }
public Inquiry(int id, string title, string description, bool isUser, InquiryTable database, Solution inquiryTable)
public Inquiry(int id, string title, string description, bool isUser, int database, int inquiryTable)
{
Id = id;
Title = title;

@ -1,4 +1,4 @@
using Entities.SQLudeoDB;
using Entities.SQLuedoDB;
using System;
using System.Collections.Generic;
using System.Linq;
@ -10,7 +10,6 @@ namespace Model.Business
public class InquiryTable
{
public int OwnerId { get; set; }
public Inquiry Owner { get; set; }
public string DatabaseName { get; set; }
public string ConnectionInfo { get; set; }
@ -22,11 +21,5 @@ namespace Model.Business
ConnectionInfo = connectionInfo;
}
public InquiryTable(Inquiry owner, string databaseName, string connectionInfo)
{
Owner = owner;
DatabaseName = databaseName;
ConnectionInfo = connectionInfo;
}
}
}

@ -9,12 +9,17 @@ namespace Model.Business
public class Lesson
{
public int Id { get; }
public string Title { get; set; }
public string LastPublisher { get; set; }
public DateOnly LastEdit { get; set; }
public string? Title { get; set; }
public string? LastPublisher { get; set; }
public DateOnly? LastEdit { get; set; }
public Lesson() { }
public Lesson(int id, string title, string lastPublisher, DateOnly lastEdit)
public Lesson(int id)
{
Id = id;
}
public Lesson(int id, string title, string lastPublisher, DateOnly? lastEdit)
{
Id = id;
Title = title;
@ -22,7 +27,7 @@ namespace Model.Business
LastEdit = lastEdit;
}
public Lesson(string title, string lastPublisher, DateOnly lastEdit)
public Lesson(string title, string lastPublisher, DateOnly? lastEdit)
{
Title = title;
LastPublisher = lastPublisher;

@ -0,0 +1,34 @@
using Entities.SQLuedoDB;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model.Business
{
public class Notepad
{
public int Id { get; set; }
public int UserId { get; set; }
public int InquiryId { get; set; }
public string Notes { get; set; }
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;
}
}
}

@ -9,14 +9,19 @@ namespace Model.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; }
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 Paragraph(int id)
{
Id = id;
}
public Paragraph(int id, string title, string content, string info, string query, string comment)
{
Id = id;

@ -1,4 +1,4 @@
using Entities.SQLudeoDB;
using Entities.SQLuedoDB;
using System;
using System.Collections.Generic;
using System.Linq;
@ -10,26 +10,23 @@ namespace Model.Business
public class Solution
{
public int OwnerId { get; set; }
public Inquiry Owner { 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, Inquiry owner, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
public Solution(int ownerId, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
{
OwnerId = ownerId;
Owner = owner;
MurdererFirstName = murdererFirstName;
MurdererLastName = murdererLastName;
MurderPlace = murderPlace;
MurderWeapon = murderWeapon;
Explanation = explanation;
}
public Solution(Inquiry owner, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
public Solution(string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
{
Owner = owner;
MurdererFirstName = murdererFirstName;
MurdererLastName = murdererLastName;
MurderPlace = murderPlace;

@ -0,0 +1,26 @@
using Entities.SQLuedoDB;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model.Business
{
public class Success
{
public int UserId { get; set; }
public int InquiryId { get; set; }
public bool IsFinished { get; set; }
public Success() { }
public Success(int userId, int inquiryId, bool isFinished)
{
UserId = userId;
InquiryId = inquiryId;
IsFinished = isFinished;
}
}
}

@ -0,0 +1,22 @@
using Entities.SQLuedoDB;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model.Business
{
public class ContentLessonDTO
{
public int LessonId { get; set; }
public int LessonPartId { get; set; }
public ContentLessonDTO(int lessonId, int lessonPartId)
{
LessonId = lessonId;
LessonPartId = lessonPartId;
}
}
}

@ -17,10 +17,10 @@ namespace Model.DTO
public bool IsUser { get; set; }
public InquiryTableDTO Database { get; set; }
public SolutionDTO InquiryTable { get; set; }
public int Database { get; set; }
public int InquiryTable { get; set; }
public InquiryDTO(int id, string title, string description, bool isUser, InquiryTableDTO database, SolutionDTO inquiryTable)
public InquiryDTO(int id, string title, string description, bool isUser, int database, int inquiryTable)
{
Id = id;
Title = title;

@ -9,19 +9,16 @@ namespace Model.DTO
{
public class InquiryTableDTO
{
private Inquiry owner;
public int OwnerId { get; set; }
public InquiryDTO Owner { get; set; }
public string DatabaseName { get; set; }
public string ConnectionInfo { get; set; }
public InquiryTableDTO() { }
public InquiryTableDTO(int ownerId, InquiryDTO owner, string databaseName, string connectionInfo)
public InquiryTableDTO(int ownerId, string databaseName, string connectionInfo)
{
OwnerId = ownerId;
Owner = owner;
DatabaseName = databaseName;
ConnectionInfo = connectionInfo;
}

@ -9,12 +9,12 @@ namespace Model.DTO
public class LessonDTO
{
public int Id { get; }
public string Title { get; set; }
public string LastPublisher { get; set; }
public DateOnly LastEdit { get; set; }
public string? Title { get; set; }
public string? LastPublisher { get; set; }
public DateOnly? LastEdit { get; set; }
public LessonDTO() { }
public LessonDTO(int id, string title, string lastPublisher, DateOnly lastEdit)
public LessonDTO(int id, string title, string lastPublisher, DateOnly? lastEdit)
{
Id = id;
Title = title;
@ -22,7 +22,7 @@ namespace Model.DTO
LastEdit = lastEdit;
}
public LessonDTO(string title, string lastPublisher, DateOnly lastEdit)
public LessonDTO(string title, string lastPublisher, DateOnly? lastEdit)
{
Title = title;
LastPublisher = lastPublisher;

@ -0,0 +1,32 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model.DTO
{
public class NotepadDTO
{
public int Id { get; set; }
public int UserId { get; set; }
public int InquiryId { get; set; }
public string Notes { get; set; }
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;
}
}
}

@ -10,26 +10,23 @@ namespace Model.DTO
public class SolutionDTO
{
public int OwnerId { get; set; }
public InquiryDTO Owner { 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, InquiryDTO owner, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
public SolutionDTO(int ownerId, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
{
OwnerId = ownerId;
Owner = owner;
MurdererFirstName = murdererFirstName;
MurdererLastName = murdererLastName;
MurderPlace = murderPlace;
MurderWeapon = murderWeapon;
Explanation = explanation;
}
public SolutionDTO(InquiryDTO owner, string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
public SolutionDTO(string murdererFirstName, string murdererLastName, string murderPlace, string murderWeapon, string explanation)
{
Owner = owner;
MurdererFirstName = murdererFirstName;
MurdererLastName = murdererLastName;
MurderPlace = murderPlace;

@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Model.DTO
{
public class SuccessDTO
{
public int UserId { get; set; }
public int InquiryId { get; set; }
public bool IsFinished { get; set; }
public SuccessDTO() { }
public SuccessDTO(int userId, int inquiryId, bool isFinished)
{
UserId = userId;
InquiryId = inquiryId;
IsFinished = isFinished;
}
}
}

@ -3,13 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entities.SQLudeoDB;
using Entities.SQLuedoDB;
using Model.Business;
using Model.DTO;
namespace Model.Mappers
{
public class BlackListMapper
public static class BlackListMapper
{
public static BlackListDTO FromModelToDTO(BlackList model)
{

@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entities.SQLuedoDB;
using Model.Business;
namespace Model.Mappers
{
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));
}
}
}

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entities.SQLudeoDB;
using Entities.SQLuedoDB;
using Model.Business;
using Model.DTO;
@ -13,32 +13,31 @@ namespace Model.Mappers
{
public static Inquiry FromDTOToModel(this InquiryDTO InqDto)
{
return new Inquiry(InqDto.Id,InqDto.Title,InqDto.Description,InqDto.IsUser,InqDto.Database.FromDTOToModel(),InqDto.InquiryTable.FromDTOToModel());
return new Inquiry(InqDto.Id,InqDto.Title,InqDto.Description,InqDto.IsUser,InqDto.Database,InqDto.InquiryTable);
}
public static Inquiry FromEntityToModel(this InquiryEntity InqEntity)
{
return new Inquiry(InqEntity.Id, InqEntity.Title, InqEntity.Description, InqEntity.IsUser, InqEntity.Database.FromEntityToModel(), InqEntity.InquiryTable.FromEntityToModel());
return new Inquiry(InqEntity.Id, InqEntity.Title, InqEntity.Description, InqEntity.IsUser, InqEntity.Database.OwnerId, InqEntity.InquiryTable.OwnerId);
}
public static InquiryEntity FromModelToEntity(this Inquiry Inq)
{
return new InquiryEntity(Inq.Id, Inq.Title, Inq.Description, Inq.IsUser, Inq.Database.FromModelToEntity(), Inq.InquiryTable.FromModelToEntity());
return new InquiryEntity(Inq.Id, Inq.Title, Inq.Description, Inq.IsUser,new InquiryTableEntity(Inq.Database),new SolutionEntity(Inq.InquiryTable));
}
public static InquiryEntity FromDTOToEntity(this InquiryDTO InqDto)
{
return new InquiryEntity(InqDto.Id, InqDto.Title, InqDto.Description, InqDto.IsUser, InqDto.Database.FromDTOToEntity(), InqDto.InquiryTable.FromDTOToEntity());
return new InquiryEntity(InqDto.Id, InqDto.Title, InqDto.Description, InqDto.IsUser, new InquiryTableEntity(InqDto.Database), new SolutionEntity(InqDto.InquiryTable));
}
public static InquiryDTO FromModelToDTO(this Inquiry Inq)
{
return new InquiryDTO(Inq.Id, Inq.Title, Inq.Description, Inq.IsUser, Inq.Database.FromModelToDTO(), Inq.InquiryTable.FromModelToDTO());
return new InquiryDTO(Inq.Id, Inq.Title, Inq.Description, Inq.IsUser, Inq.Database, Inq.InquiryTable);
}
public static InquiryDTO FromEntityToDTO(this InquiryEntity InqEntity)
{
return new InquiryDTO(InqEntity.Id, InqEntity.Title, InqEntity.Description, InqEntity.IsUser, InqEntity.Database.FromEntityToDTO(), InqEntity.InquiryTable.FromEntityToDTO());
return new InquiryDTO(InqEntity.Id, InqEntity.Title, InqEntity.Description, InqEntity.IsUser, InqEntity.Database.OwnerId, InqEntity.InquiryTable.OwnerId);
}
}

@ -5,7 +5,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entities.SQLudeoDB;
using Entities.SQLuedoDB;
namespace Model.Mappers
{
@ -23,12 +23,12 @@ namespace Model.Mappers
public static InquiryTableDTO FromModelToDTO(this InquiryTable InqT)
{
return new InquiryTableDTO(InqT.OwnerId, InqT.Owner.FromModelToDTO(), InqT.DatabaseName, InqT.ConnectionInfo);
return new InquiryTableDTO(InqT.OwnerId, InqT.DatabaseName, InqT.ConnectionInfo);
}
public static InquiryTableDTO FromEntityToDTO(this InquiryTableEntity InqTEntity)
{
return new InquiryTableDTO(InqTEntity.OwnerId, InqTEntity.Owner.FromEntityToDTO(), InqTEntity.DatabaseName, InqTEntity.ConnectionInfo);
return new InquiryTableDTO(InqTEntity.OwnerId, InqTEntity.DatabaseName, InqTEntity.ConnectionInfo);
}
public static InquiryTableEntity FromModelToEntity(this InquiryTable InqT)

@ -3,13 +3,13 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entities.SQLudeoDB;
using Entities.SQLuedoDB;
using Model.Business;
using Model.DTO;
namespace Model.Mappers
{
public class LessonMapper
public static class LessonMapper
{
public static LessonDTO FromModelToDTO(Lesson model)
@ -43,3 +43,4 @@ namespace Model.Mappers
}
}
}

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entities.SQLuedoDB;
using Model.Business;
using Model.DTO;
namespace Model.Mappers
{
public static class NotepadMapper
{
public static Notepad FromDTOToModel(this NotepadDTO dto)
{
return new Notepad(dto.Id, dto.UserId, dto.InquiryId, dto.Notes);
}
public static Notepad FromEntityToModel(this NotepadEntity ent)
{
return new Notepad(ent.Id, ent.UserId, ent.InquiryId, ent.Notes);
}
public static NotepadDTO FromModelToDTO(this Notepad not)
{
return new NotepadDTO(not.Id, not.UserId, not.InquiryId, not.Notes);
}
public static NotepadDTO FromEntityToDTO(this NotepadEntity ent)
{
return new NotepadDTO(ent.Id, ent.UserId, ent.InquiryId, ent.Notes);
}
public static NotepadEntity FromDTOToEntity(this NotepadDTO dto)
{
return new NotepadEntity(dto.Id,new UserEntity(dto.UserId), dto.UserId, new InquiryEntity(dto.InquiryId), dto.Notes);
}
public static NotepadEntity FromModelToEntity(this Notepad not)
{
return new NotepadEntity(not.Id, new UserEntity(not.UserId), not.UserId, new InquiryEntity(not.InquiryId), not.Notes);
}
}
}

@ -3,10 +3,40 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entities.SQLuedoDB;
using Model.Business;
using Model.DTO;
namespace Model.Mappers
{
internal class ParagraphMapper
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);
}
public static Paragraph FromEntityToModel(ParagraphEntity model)
{
return new Paragraph(model.Id, model.Title, model.Content, 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);
}
public static ParagraphDTO FromModelToDTO(Paragraph model)
{
return new ParagraphDTO(model.Id, model.Title, model.Content, model.Info, model.Query, model.Comment);
}
public static ParagraphEntity FromDTOToEntity(ParagraphDTO dto)
{
return new ParagraphEntity(dto.Id, dto.Title, dto.Content, dto.Info, dto.Query, dto.Comment);
}
public static Paragraph FromModelToEntity(Paragraph model)
{
return new Paragraph(model.Id, model.Title, model.Content, model.Info, model.Query, model.Comment);
}
}
}

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entities.SQLudeoDB;
using Entities.SQLuedoDB;
using Model.Business;
using Model.DTO;
@ -13,31 +13,31 @@ namespace Model.Mappers
{
public static Solution FromDTOToModel(this SolutionDTO dto)
{
return new Solution(dto.OwnerId,dto.Owner.FromDTOToModel(),dto.MurdererFirstName,dto.MurdererLastName,dto.MurderPlace,dto.MurderWeapon,dto.Explanation);
return new Solution(dto.OwnerId,dto.MurdererFirstName,dto.MurdererLastName,dto.MurderPlace,dto.MurderWeapon,dto.Explanation);
}
public static Solution FromEntityToModel(this SolutionEntity entity)
{
return new Solution(entity.OwnerId, entity.Owner.FromEntityToModel(), entity.MurdererFirstName, entity.MurdererLastName, entity.MurderPlace, entity.MurderWeapon, entity.Explanation);
return new Solution(entity.OwnerId, entity.MurdererFirstName, entity.MurdererLastName, entity.MurderPlace, entity.MurderWeapon, entity.Explanation);
}
public static SolutionDTO FromModelToDTO(this Solution model)
{
return new SolutionDTO(model.OwnerId, model.Owner.FromModelToDTO(), model.MurdererFirstName, model.MurdererLastName, model.MurderPlace, model.MurderWeapon, model.Explanation);
return new SolutionDTO(model.OwnerId, model.MurdererFirstName, model.MurdererLastName, model.MurderPlace, model.MurderWeapon, model.Explanation);
}
public static SolutionDTO FromEntityToDTO(this SolutionEntity entity)
{
return new SolutionDTO(entity.OwnerId, entity.Owner.FromEntityToDTO(), entity.MurdererFirstName, entity.MurdererLastName, entity.MurderPlace, entity.MurderWeapon, entity.Explanation);
return new SolutionDTO(entity.OwnerId, entity.MurdererFirstName, entity.MurdererLastName, entity.MurderPlace, entity.MurderWeapon, entity.Explanation);
}
public static SolutionEntity FromModelToEntity(this Solution model)
{
return new SolutionEntity(model.OwnerId, model.Owner.FromModelToEntity(), model.MurdererFirstName, model.MurdererLastName, model.MurderPlace, model.MurderWeapon, model.Explanation);
return new SolutionEntity(model.OwnerId, new InquiryEntity(model.OwnerId), model.MurdererFirstName, model.MurdererLastName, model.MurderPlace, model.MurderWeapon, model.Explanation);
}
public static SolutionEntity FromDTOToEntity(this SolutionDTO dto)
{
return new SolutionEntity(dto.OwnerId, dto.Owner.FromDTOToEntity(), dto.MurdererFirstName, dto.MurdererLastName, dto.MurderPlace, dto.MurderWeapon, dto.Explanation);
return new SolutionEntity(dto.OwnerId, new InquiryEntity(dto.OwnerId), dto.MurdererFirstName, dto.MurdererLastName, dto.MurderPlace, dto.MurderWeapon, dto.Explanation);
}
}
}

@ -0,0 +1,44 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Entities.SQLuedoDB;
using Model.Business;
using Model.DTO;
namespace Model.Mappers
{
public static class SuccessMapper
{
public static Success FromDTOToModel(this SuccessDTO dto)
{
return new Success(dto.UserId, dto.InquiryId, dto.IsFinished);
}
public static Success FromEntityToModel(this SuccessEntity ent)
{
return new Success(ent.UserId, ent.InquiryId, ent.IsFinished);
}
public static SuccessDTO FromModelToDTO(this Success suc)
{
return new SuccessDTO(suc.UserId, suc.InquiryId, suc.IsFinished);
}
public static SuccessDTO FromEntityToDTO(this SuccessEntity ent)
{
return new SuccessDTO(ent.UserId, ent.InquiryId, ent.IsFinished);
}
public static SuccessEntity FromDTOToEntity(this SuccessDTO dto)
{
return new SuccessEntity(dto.UserId,new UserEntity(dto.UserId),dto.InquiryId,new InquiryEntity(dto.InquiryId),dto.IsFinished);
}
public static SuccessEntity FromModelToEntity(this Success suc)
{
return new SuccessEntity(suc.UserId, new UserEntity(suc.UserId), suc.InquiryId, new InquiryEntity(suc.InquiryId), suc.IsFinished);
}
}
}

@ -1,4 +1,4 @@
using Entities.SQLudeoDB;
using Entities.SQLuedoDB;
using Model.Business;
using Model.DTO;

Loading…
Cancel
Save