Fin mapper Inquiry

pull/26/head
Maxime SAPOUNTZIS 1 year ago
parent 76791a0e27
commit 942b14631d

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

@ -16,5 +16,30 @@ namespace Model.Mappers
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.FromDTOToModel(),InqDto.InquiryTable.FromDTOToModel());
} }
public static Inquiry FromEntityToModel(this InquiryEntity InqEntity)
{
return new Inquiry(InqEntity.Id, InqEntity.Title, InqEntity.Description, InqEntity.IsUser, InqEntity.Database.FromEntityToModel(), InqEntity.InquiryTable.FromEntityToModel());
}
public static InquiryEntity FromModelToEntity(this Inquiry Inq)
{
return new InquiryEntity(Inq.Id, Inq.Title, Inq.Description, Inq.IsUser, Inq.Database.FromModelToEntity(), Inq.InquiryTable.FromModelToEntity());
}
public static InquiryEntity FromDTOToEntity(this InquiryDTO InqDto)
{
return new InquiryEntity(InqDto.Id, InqDto.Title, InqDto.Description, InqDto.IsUser, InqDto.Database.FromDTOToEntity(), InqDto.InquiryTable.FromDTOToEntity());
}
public static InquiryDTO FromModelToDTO(this Inquiry Inq)
{
return new InquiryDTO(Inq.Id, Inq.Title, Inq.Description, Inq.IsUser, Inq.Database.FromModelToDTO(), Inq.InquiryTable.FromModelToDTO());
}
public static InquiryDTO FromEntityToDTO(this InquiryEntity InqEntity)
{
return new InquiryDTO(InqEntity.Id, InqEntity.Title, InqEntity.Description, InqEntity.IsUser, InqEntity.Database.FromEntityToDTO(), InqEntity.InquiryTable.FromEntityToDTO());
}
} }
} }

@ -5,6 +5,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Entities.SQLudeoDB;
namespace Model.Mappers namespace Model.Mappers
{ {
@ -15,9 +16,29 @@ namespace Model.Mappers
return new InquiryTable(InqTDto.OwnerId, InqTDto.ConnectionInfo, InqTDto.DatabaseName); return new InquiryTable(InqTDto.OwnerId, InqTDto.ConnectionInfo, InqTDto.DatabaseName);
} }
public static InquiryTable FromEntityToModel(this InquiryTableEntity InqTEntity)
{
return new InquiryTable(InqTEntity.OwnerId, InqTEntity.ConnectionInfo, InqTEntity.DatabaseName);
}
public static InquiryTableDTO FromModelToDTO(this InquiryTable InqT) public static InquiryTableDTO FromModelToDTO(this InquiryTable InqT)
{ {
return new InquiryTableDTO(InqT.OwnerId, InqT.Owner, InqT.DatabaseName, InqT.ConnectionInfo); return new InquiryTableDTO(InqT.OwnerId, InqT.Owner.FromModelToDTO(), InqT.DatabaseName, InqT.ConnectionInfo);
}
public static InquiryTableDTO FromEntityToDTO(this InquiryTableEntity InqTEntity)
{
return new InquiryTableDTO(InqTEntity.OwnerId, InqTEntity.Owner.FromEntityToDTO(), InqTEntity.DatabaseName, InqTEntity.ConnectionInfo);
}
public static InquiryTableEntity FromModelToEntity(this InquiryTable InqT)
{
return new InquiryTableEntity(InqT.OwnerId, InqT.DatabaseName, InqT.ConnectionInfo);
}
public static InquiryTableEntity FromDTOToEntity(this InquiryTableDTO dto)
{
return new InquiryTableEntity(dto.OwnerId, dto.DatabaseName, dto.ConnectionInfo);
} }
} }
} }

@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using Entities.SQLudeoDB;
using Model.Business; using Model.Business;
using Model.DTO; using Model.DTO;
@ -14,5 +15,29 @@ namespace Model.Mappers
{ {
return new Solution(dto.OwnerId,dto.Owner.FromDTOToModel(),dto.MurdererFirstName,dto.MurdererLastName,dto.MurderPlace,dto.MurderWeapon,dto.Explanation); return new Solution(dto.OwnerId,dto.Owner.FromDTOToModel(),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);
}
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);
}
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);
}
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);
}
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);
}
} }
} }

Loading…
Cancel
Save