Beispiel #1
0
        public static DTO.User ToDto(this Display.User displayEntity)
        {
            DTO.UserCredential credential = new DTO.UserCredential(displayEntity.Credential.Login, displayEntity.Credential.OldPassword, displayEntity.Credential.NewPassword);

            var dto = new DTO.User(
                displayEntity.Id,
                displayEntity.Key,
                displayEntity.Role.ToDto(),
                displayEntity.Identity.ToDto(),
                credential,
                displayEntity.RoleTypes.ToDTOList());

            return(dto);
        }
Beispiel #2
0
        public static Display.User ToDisplayEntity(this DTO.User dto)
        {
            var displayEntity = new Display.User();

            displayEntity.Id       = dto.Id;
            displayEntity.Key      = dto.Key;
            displayEntity.Identity = dto.Identity.ToDisplayEntity();
            displayEntity.Role     = dto.Role.ToDisplayEntity();
            if (dto.Credential != null)
            {
                displayEntity.Credential.Login       = dto.Credential.Login;
                displayEntity.Credential.OldPassword = dto.Credential.OldPassword;
                displayEntity.Credential.NewPassword = dto.Credential.NewPassword;
            }

            return(displayEntity);
        }