46 lines
1.0 KiB
C#
46 lines
1.0 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using BS.Shared.DataContracts.Feature.AI;
|
|
|
|
namespace BeWo.ViewModel.ListViewModel
|
|
{
|
|
public class AiPromptbausteinFolderListVM : AbstractDCListMapperVM<AiPromptbausteinFolderDC, AiPromptbausteinFolderVM>
|
|
{
|
|
public AiPromptbausteinFolderListVM(IEnumerable<AiPromptbausteinFolderDC> pDataContracts = null, AiPromptbausteinFolderVM parent = null) : base(pDataContracts)
|
|
{
|
|
foreach (var vm in VMList)
|
|
{
|
|
vm.Parent = parent;
|
|
|
|
if(vm.DataContract.ParentFolderOid != null)
|
|
{
|
|
vm.ParentFolderOid = parent?.DataContract?.Oid;
|
|
}
|
|
}
|
|
}
|
|
|
|
public bool ContainsDirtyObject()
|
|
{
|
|
if (IsDirty)
|
|
return true;
|
|
|
|
foreach (var vm in VMList)
|
|
{
|
|
if (vm.DataContract.Oid < -1)
|
|
return false;
|
|
|
|
if (vm.SubFolders is object && vm.SubFolders.ContainsDirtyObject())
|
|
return true;
|
|
|
|
if (vm.SubPrompts is object && vm.SubPrompts.IsDirty)
|
|
return true;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|