using System.Collections.Generic; using xCommons.Extensions; using xFileService.Models.Dtos; using xFileService.Models.Entities; namespace xFileService.Extensions { public static class xFileServiceExtensions { /// /// Map Global Properties From XFile to XFile Dto ... /// /// /// public static XFileDto ToDto(this XFile source) { // XFileDto result = null; // if (!source.IsNullOrDefault()) { // result = new XFileDto(); result = result.UpdateData( updateWith: source, propertyBlackList: new List { nameof(XFileDto.Owner), nameof(XFile.Deleted), nameof(XFile.References), } ); } // return result; } /// /// Converts a Dto to Entity Representation ... /// Ignore ID Property ... /// /// /// public static XFile FromDto(this XFileDto source) { // var result = new XFile(); // if (!source.IsNull()) { // result = result.UpdateData( updateWith: source, propertyBlackList: new List { nameof(XFile.Deleted), nameof(XFile.References), } ); // if (!source.References.IsNull() && source.References.HasChild()) { result.References = source.References.ToListString(); } } // return result; } } }