This commit is contained in:
@@ -221,7 +221,23 @@ namespace AyaNova.Biz
|
||||
|
||||
//Other job handlers here...
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
//DUPLICATE ATTACHMENTS TO NEW OBJECT
|
||||
//
|
||||
internal static async Task DuplicateAttachments(AyaTypeId aSource, AyaTypeId aDest, AyContext ct)
|
||||
{
|
||||
var sources = await ct.FileAttachment.AsNoTracking()
|
||||
.Where(z => z.AttachToAType == aSource.AType && z.AttachToObjectId == aSource.ObjectId)
|
||||
.ToListAsync();
|
||||
if (sources.Count > 0)
|
||||
{
|
||||
foreach (var src in sources)
|
||||
{
|
||||
ct.FileAttachment.Add(new FileAttachment { AttachToObjectId = aDest.ObjectId, AttachToAType = aDest.AType, StoredFileName = src.StoredFileName, DisplayFileName = src.DisplayFileName, ContentType = src.ContentType, LastModified = src.LastModified, Notes = src.Notes, Exists = src.Exists, Size = src.Size });
|
||||
}
|
||||
await ct.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
Reference in New Issue
Block a user