Start Implementing XBaseFileProvider ...

This commit is contained in:
2025-12-08 04:41:52 +03:30
parent 64969bf9b1
commit 4cf1e4d629
7 changed files with 433 additions and 149 deletions
+46 -16
View File
@@ -1,3 +1,4 @@
using System.Collections.Generic;
using xCommons.Extensions;
using xFileService.Models.Dtos;
using xFileService.Models.Entities;
@@ -11,7 +12,7 @@ namespace xFileService.Extensions
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static XFileDto ToXFileDto(this XFile source)
public static XFileDto ToDto(this XFile source)
{
//
XFileDto result = null;
@@ -21,25 +22,54 @@ namespace xFileService.Extensions
{
//
result = new XFileDto();
result = result.UpdateData(source);
//
// result = new XFileDto
// {
// Id = source.Id,
// Type = source.Type,
// OwnerId = source.OwnerId,
// Name = source.Name,
// Path = source.Path,
// Thumb = source.Thumb,
// ThumbPath = source.ThumbPath,
// UploadedOn = source.UploadedOn,
// FileName = source.FileName
// };
result = result.UpdateData(
updateWith: source,
propertyBlackList: new List<string>
{
nameof(XFileDto.Owner),
nameof(XFile.Deleted),
nameof(XFile.References),
}
);
}
//
return result;
}
/// <summary>
/// Converts a Dto to Entity Representation ...
/// Ignore ID Property ...
/// </summary>
/// <param name="source"></param>
/// <returns></returns>
public static XFile FromDto(this XFileDto source)
{
//
var result = new XFile();
//
if (!source.IsNull())
{
//
result = result.UpdateData(
updateWith: source,
propertyBlackList: new List<string>
{
nameof(XFile.Deleted),
nameof(XFile.References),
}
);
//
if (!source.References.IsNull() && source.References.HasChild()) {
result.References = source.References.ToListString();
}
}
//
return result;
}
}
}