67 lines
1.6 KiB
C#
67 lines
1.6 KiB
C#
using LCU.Library.Internal.ApiResponse.Models;
|
|
using LCU.Library.Internal.FileOperationsModels.Models.NameSettings;
|
|
using LCU.Library.Internal.FileOperationsModels.Shared;
|
|
using System.ComponentModel.DataAnnotations;
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
namespace LCU.Library.Internal.FileOperationsModels.Models
|
|
{
|
|
public abstract class FileRequest : ReturnResponse
|
|
{
|
|
[Required(ErrorMessage = "Source path is required")]
|
|
public string SourcePath { get; set; }
|
|
|
|
[Required(ErrorMessage = "Source file is required")]
|
|
public string SourceFile { get; set; }
|
|
|
|
[Required(ErrorMessage = "Destination path is required.")]
|
|
public string DestinationPath { get; set; }
|
|
|
|
public string DestinationName { get; set; }
|
|
|
|
public bool Overwrite { get; set; }
|
|
|
|
public bool SucceedOnError { get; set; }
|
|
|
|
public DynamicNameSetting FileNameSetting { get; set; }
|
|
|
|
[NotMapped]
|
|
public string FinalSourceFile
|
|
{
|
|
get
|
|
{
|
|
return DynamicNameBuilder.BuildDynamicName(SourceFile, FileNameSetting);
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string FinalDestinationName
|
|
{
|
|
get
|
|
{
|
|
return string.IsNullOrWhiteSpace(DestinationName) ? FinalSourceFile : DestinationName;
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string Source
|
|
{
|
|
get
|
|
{
|
|
var finalSourcePath = SourcePath.EndsWith("\\") ? SourcePath : $"{SourcePath}\\";
|
|
return finalSourcePath + FinalSourceFile;
|
|
}
|
|
}
|
|
|
|
[NotMapped]
|
|
public string Destination
|
|
{
|
|
get
|
|
{
|
|
var finalDestinationPath = DestinationPath.EndsWith("\\") ? DestinationPath : $"{DestinationPath}\\";
|
|
return finalDestinationPath + FinalDestinationName;
|
|
}
|
|
}
|
|
}
|
|
}
|