public void SaveRoot(AssetFolderDM folder, Guid actedBy) { if (folder.IsRoot) { DB.Insert <AssetStructureDM>(new AssetStructureDM(folder.FolderId, Guid.Empty, true, 1, folder.Code), actedBy); } }
private void ThrowIfNoFolderName(AssetFolderDM item) { if (string.IsNullOrEmpty(item.Name)) { throw new ExpectedException("No folder name."); } }
private AssetFolderDM SaveRoot(Guid userId) { var root = new AssetFolderDM() { Name = "My Assets", UserId = userId, Code = Let <SerialNo>().GenerateSerialNo(SerialNoType.AssetFolderCode, userId), IsRoot = true, }; DB.Insert <AssetFolderDM>(root, userId); Let <AssetStructure>().SaveRoot(root, userId); return(root); }
public void Save(AssetFolderDM item, Guid folderId, Guid actedBy) { ThrowIfNoFolderName(item); item.Name = StringHelper.ToFolderName(item.Name); if (item.FolderId.Equals(Guid.Empty)) { item.Code = Let <SerialNo>().GenerateSerialNo(SerialNoType.AssetFolderCode, actedBy); DB.Insert <AssetFolderDM>(item, actedBy); SaveStructure(item.FolderId, folderId, actedBy); } else { DB.Update <AssetFolderDM>(item, actedBy); } }
public void Save(AssetFolderDM item, Guid actedBy) { Save(item, Guid.Empty, actedBy); }