26 lines
847 B
C#
26 lines
847 B
C#
using System;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.Linq;
|
|
using System.Reflection;
|
|
using LCU.Library.Internal.ApiResponse.Models;
|
|
using LCU.Library.Internal.FileOperationsModels.Enums;
|
|
|
|
namespace LCU.Library.Internal.FileOperationsModels.Models.Responses;
|
|
|
|
public class FileSizeResponse : ReturnResponse
|
|
{
|
|
public string FileName { get; set; } = string.Empty;
|
|
public decimal FileSize { get; set; }
|
|
public FileSizeTypes FileSizeType { get; set; }
|
|
|
|
[NotMapped]
|
|
public string FileSizeString
|
|
{
|
|
get
|
|
{
|
|
var fileSizeType = FileSizeType.GetType().GetMember(FileSizeType.ToString()).First().GetCustomAttribute<DisplayAttribute>()?.Name;
|
|
return $"{Math.Round(FileSize, 6):0.######} {fileSizeType}";
|
|
}
|
|
}
|
|
} |