Newsbot.Collector/Newsbot.Collector.Domain/Dto/ArticleDetailsDto.cs

42 lines
1.3 KiB
C#
Raw Normal View History

using Newsbot.Collector.Domain.Models;
namespace Newsbot.Collector.Domain.Dto;
public class ArticleDetailsDto
{
public Guid ID { get; set; }
public string[]? Tags { get; set; }
public string? Title { get; set; }
public string? Url { get; set; }
public DateTime PubDate { get; set; }
public string? Video { get; set; }
public int VideoHeight { get; set; }
public int VideoWidth { get; set; }
public string? Thumbnail { get; set; }
public string? Description { get; set; }
public string? AuthorName { get; set; }
public string? AuthorImage { get; set; }
public SourceDto? Source { get; set; }
public static ArticleDetailsDto Convert(ArticlesModel article, SourceModel source)
{
return new ArticleDetailsDto
{
ID = article.ID,
Tags = article.Tags.Split(','),
Title = article.Title,
Url = article.URL,
PubDate = article.PubDate,
Video = article.Video,
VideoHeight = article.VideoHeight,
VideoWidth = article.VideoWidth,
Thumbnail = article.Thumbnail,
Description = article.Description,
AuthorName = article.AuthorName,
AuthorImage = article.AuthorImage,
Source = SourceDto.Convert(source)
};
}
}