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

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

            return(dto);
        }
Exemple #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);
        }