Updating
This commit is contained in:
+66
@@ -0,0 +1,66 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user