29 lines
1.0 KiB
C#
29 lines
1.0 KiB
C#
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
using System.IO;
|
|
using LCU.Library.Internal.FileOperationsModels.Models.NameSettings;
|
|
using LCU.Library.Internal.FileOperationsModels.Shared;
|
|
|
|
namespace LCU.Library.Internal.FileOperationsModels.Models.Requests;
|
|
|
|
public class FileDestinationRequest
|
|
{
|
|
[Required(ErrorMessage = "Destination path is required.")]
|
|
public string DestinationPath { get; set; }
|
|
public DynamicNameSetting DestinationPathSettings { get; set; }
|
|
public string DestinationName { get; set; } = string.Empty;
|
|
public bool Overwrite { get; set; }
|
|
|
|
[NotMapped]
|
|
public string FinalDestinationPath
|
|
{
|
|
get
|
|
{
|
|
var destinationPath = DestinationPath.EndsWith("\\") ? DestinationPath : $"{DestinationPath}\\";
|
|
return DynamicNameBuilder.BuildDynamicName(destinationPath, DestinationPathSettings);
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string Destination => Path.Combine(FinalDestinationPath, DestinationName);
|
|
} |