generated from ricardo/MVCLogin
65 lines
2.2 KiB
C#
65 lines
2.2 KiB
C#
using Postall.Domain.Entities;
|
|
using System;
|
|
|
|
namespace Postall.Domain.Dtos
|
|
{
|
|
public class VideoResponse
|
|
{
|
|
public string Id { get; set; }
|
|
public string VideoId { get; set; }
|
|
public string ChannelId { get; set; }
|
|
public string Title { get; set; }
|
|
public string Description { get; set; }
|
|
public string ThumbnailUrl { get; set; }
|
|
public DateTime PublishedAt { get; set; }
|
|
public ulong ViewCount { get; set; }
|
|
public ulong LikeCount { get; set; }
|
|
public ulong DislikeCount { get; set; }
|
|
public ulong CommentCount { get; set; }
|
|
}
|
|
|
|
public static class VideoDataExtensions
|
|
{
|
|
public static VideoResponse ToVideoResponse(this VideoData videoData)
|
|
{
|
|
if (videoData == null)
|
|
return null;
|
|
|
|
return new VideoResponse
|
|
{
|
|
Id = videoData.Id,
|
|
VideoId = videoData.VideoId,
|
|
ChannelId = videoData.ChannelId,
|
|
Title = videoData.Title,
|
|
Description = videoData.Description,
|
|
ThumbnailUrl = videoData.ThumbnailUrl,
|
|
PublishedAt = videoData.PublishedAt,
|
|
ViewCount = videoData.ViewCount,
|
|
LikeCount = videoData.LikeCount,
|
|
DislikeCount = videoData.DislikeCount,
|
|
CommentCount = videoData.CommentCount
|
|
};
|
|
}
|
|
|
|
public static VideoData ToVideoData(this VideoResponse videoResponse)
|
|
{
|
|
if (videoResponse == null)
|
|
return null;
|
|
|
|
return new VideoData
|
|
{
|
|
Id = videoResponse.Id,
|
|
VideoId = videoResponse.VideoId,
|
|
ChannelId = videoResponse.ChannelId,
|
|
Title = videoResponse.Title,
|
|
Description = videoResponse.Description,
|
|
ThumbnailUrl = videoResponse.ThumbnailUrl,
|
|
PublishedAt = videoResponse.PublishedAt,
|
|
ViewCount = videoResponse.ViewCount,
|
|
LikeCount = videoResponse.LikeCount,
|
|
DislikeCount = videoResponse.DislikeCount,
|
|
CommentCount = videoResponse.CommentCount
|
|
};
|
|
}
|
|
}
|
|
} |