public async Task <bool> AddItemAsync(UnifiedSetData unifiedSet) { unifiedSet.UnifiedSetGuid = Guid.NewGuid(); unifiedSet.Created = DateTime.UtcNow; if (unifiedSet.UnifiedMode == PageDefinition.UnifiedModeEnum.SkinDynamicContent) { unifiedSet.PageList = new List <string>(); } else { unifiedSet.PageSkin = new SkinDefinition(); } unifiedSet.PageGuids = await UpdatePageGuidsAsync(unifiedSet.UnifiedSetGuid, unifiedSet.PageList); if (!await DataProvider.AddAsync(unifiedSet)) { return(false); } await Auditing.AddAuditAsync($"{nameof(UnifiedSetDataProvider)}.{nameof(AddItemAsync)}", Dataset, Guid.Empty, $"Add UPS {unifiedSet.Name}", DataBefore : null, DataAfter : unifiedSet ); return(true); }
public async Task <UpdateStatusEnum> UpdateItemAsync(UnifiedSetData unifiedSet) { UnifiedSetData origData = Auditing.Active ? await GetItemAsync(unifiedSet.UnifiedSetGuid) : null; unifiedSet.Updated = DateTime.UtcNow; if (unifiedSet.UnifiedMode == PageDefinition.UnifiedModeEnum.SkinDynamicContent) { unifiedSet.PageList = new List <string>(); } else { unifiedSet.PageSkin = new SkinDefinition(); } unifiedSet.PageGuids = await UpdatePageGuidsAsync(unifiedSet.UnifiedSetGuid, unifiedSet.PageList); UpdateStatusEnum status = await DataProvider.UpdateAsync(unifiedSet.UnifiedSetGuid, unifiedSet.UnifiedSetGuid, unifiedSet); if (status != UpdateStatusEnum.OK) { return(status); } await Auditing.AddAuditAsync($"{nameof(UnifiedSetDataProvider)}.{nameof(UpdateItemAsync)}", Dataset, Guid.Empty, $"Update UPS {unifiedSet.Name}", DataBefore : origData, DataAfter : unifiedSet ); return(status); }
// API // API // API public async Task <UnifiedSetData> GetItemAsync(Guid unifiedSetGuid) { UnifiedSetData unifiedSet = await DataProvider.GetAsync(unifiedSetGuid); if (unifiedSet == null) { return(null); } unifiedSet.PageList = await GetPageListFromGuidsAsync(unifiedSet.PageGuids); return(unifiedSet); }
public async Task <bool> RemoveItemAsync(Guid unifiedSetGuid) { UnifiedSetData origData = Auditing.Active ? await GetItemAsync(unifiedSetGuid) : null; if (!await DataProvider.RemoveAsync(unifiedSetGuid)) { return(false); } await RemoveGuidAsync(unifiedSetGuid); await Auditing.AddAuditAsync($"{nameof(UnifiedSetDataProvider)}.{nameof(RemoveItemAsync)}", Dataset, Guid.Empty, $"Remove UPS {unifiedSetGuid}", DataBefore : origData, DataAfter : null ); return(true); }