public async Task <List <SubscriptionGroupPart> > GetAsync(SubscriptionLevelPart group, bool allowMultiple) { var subscriptions = await _subscriptionsService.GetAllAsync(); if (subscriptions == null) { return(null); } var results = new List <SubscriptionGroupPart>(); foreach (var subscription in subscriptions) { if (allowMultiple && !group.SubscriptionSelection.Any(x => x.Identifier == subscription.Identifier && x.IsSelected)) { continue; } if (!allowMultiple && group.Subscription != subscription.Identifier) { continue; } results.Add(new SubscriptionGroupPart { ContentItem = subscription.ContentItem.As <SubscriptionGroupSelectPart>().ContentItem, Identifier = subscription.ContentItem.As <SubscriptionGroupSelectPart>().SubscriptionGroup }); } return(results); }
public override async Task <IDisplayResult> EditAsync(SubscriptionAccessPart part, BuildPartEditorContext context) { var subscriptions = await _subscriptionsService.GetAllAsync(); return(Initialize <SubscriptionAccessPartViewModel>("SubscriptionAccessPart_Edit", model => { model.SubscriptionSelection = _subscriptionPartService.SelectedSubscriptionParts(subscriptions, part); }) .Location("Parts#Subscription:5")); }