using xCommons.Extensions;
using System.Collections.Generic;
using xAiApi.AI.Models.Entities;
using xAiModels.Models;
namespace xAiApi.AI.Extensions
{
///
/// Extensions which used for AiModels ...
///
public static class AiModelsExtensions
{
///
/// Converts Entity to Dto regardsless of Owner and NavigationProperties ...
///
///
///
public static XAiMessageDto ToDto(this XAiMessage source)
{
//
XAiMessageDto result = null;
//
if (!source.IsNullOrDefault())
{
//
result = new XAiMessageDto();
result = result.UpdateData(
updateWith: source,
propertyBlackList: new List
{
nameof(XAiMessage.Deleted),
nameof(XAiMessageDto.Owner),
nameof(XAiMessage.Conversation),
}
);
}
//
return result;
}
///
/// Converts Entity to Dto regardsless of Owner and NavigationProperties ...
///
///
///
public static XAiProjectDto ToDto(this XAiProject source)
{
//
XAiProjectDto result = null;
//
if (!source.IsNullOrDefault())
{
//
result = new XAiProjectDto();
result = result.UpdateData(
updateWith: source,
propertyBlackList: new List
{
nameof(XAiProject.Deleted),
nameof(XAiProjectDto.Owner),
nameof(XAiProject.Conversations),
}
);
}
//
return result;
}
///
/// Converts Entity to Dto regardsless of Owner and NavigationProperties ...
///
///
///
public static XAiConversationDto ToDto(this XAiConversation source)
{
//
XAiConversationDto result = null;
//
if (!source.IsNullOrDefault())
{
//
result = new XAiConversationDto();
result = result.UpdateData(
updateWith: source,
propertyBlackList: new List
{
nameof(XAiConversation.Deleted),
nameof(XAiConversation.Project),
nameof(XAiConversationDto.Owner),
nameof(XAiConversation.Messages),
}
);
}
//
return result;
}
}
}