api/NetinaCMS.Domain/Dtos/SmallDto/StorageFileSDto.cs

27 lines
879 B
C#

using NetinaCMS.Domain.Entities.StorageFiles;
using NetinaCMS.Domain.Enums;
namespace NetinaCMS.Domain.Dtos.SmallDto;
public class StorageFileSDto : BaseDto<StorageFileSDto, StorageFile>
{
public string Name { get; set; } = string.Empty;
public string FileLocation { get; set; } = string.Empty;
public string FileName { get; set; } = string.Empty;
public bool IsHeader { get; set; }
public bool IsPrimary { get; set; }
public StorageFileType FileType { get; set; }
public bool Selected { get; set; }
public DateTime CreatedAt
{
get
{
string date = FileName.Split('.').First().Split('_').Last();
if (!date.IsNullOrEmpty() && long.TryParse(date, out long longDate))
return DateTimeExtensions.UnixTimeStampToDateTime(longDate);
return DateTime.MinValue;
}
}
}