You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
API_SQLuedo/API_SQLuedo/Shared/Mapper/NotepadMapper.cs

64 lines
1.5 KiB

using Dto;
using Entities;
using Model;
namespace Shared.Mapper;
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
{
Id = dto.Id,
User = new UserEntity
{
Id = dto.UserId
},
UserId = dto.UserId,
Inquiry = new InquiryEntity
{
Id = dto.InquiryId
},
Notes = dto.Notes
};
}
public static NotepadEntity FromModelToEntity(this Notepad not)
{
return new NotepadEntity
{
Id = not.Id,
User = new UserEntity
{
Id = not.UserId
},
UserId = not.UserId,
Inquiry = new InquiryEntity
{
Id = not.InquiryId
},
Notes = not.Notes
};
}
}