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.
38 lines
1.1 KiB
38 lines
1.1 KiB
using Dto;
|
|
using Entities;
|
|
using Model;
|
|
|
|
namespace Shared.Mapper;
|
|
|
|
public static class UserMapper
|
|
{
|
|
public static User FromDTOToModel(this UserDto dto)
|
|
{
|
|
return new User(dto.Id, dto.Username, dto.Password, dto.Email, dto.IsAdmin);
|
|
}
|
|
|
|
public static UserEntity FromDTOToEntity(this UserDto dto)
|
|
{
|
|
return new UserEntity(dto.Id, dto.Username, dto.Password, dto.Email, dto.IsAdmin);
|
|
}
|
|
|
|
public static User FromEntityToModel(this UserEntity entity)
|
|
{
|
|
return new User(entity.Id, entity.Username, entity.Password, entity.Email, entity.IsAdmin);
|
|
}
|
|
|
|
public static UserDto FromEntityToDTO(this UserEntity entity)
|
|
{
|
|
return new UserDto(entity.Id, entity.Username, entity.Password, entity.Email, entity.IsAdmin);
|
|
}
|
|
|
|
public static UserDto FromModelToDTO(this User user)
|
|
{
|
|
return new UserDto(user.Id, user.Username, user.Password, user.Email, user.IsAdmin);
|
|
}
|
|
|
|
public static UserEntity FromModelToEntity(this User user)
|
|
{
|
|
return new UserEntity(user.Id, user.Username, user.Password, user.Email, user.IsAdmin);
|
|
}
|
|
} |