async public Task <List <int[]> > Index()
        {
            var userId = await UserAccessor.GetCurrentIndividualId();

            var giftsWithReceivers = AccessControlService.GetVisibleGiftReceiverPairs(userId);

            return(await giftsWithReceivers.ToListAsync());
        }
Exemplo n.º 2
0
        async public Task <DataContext> Index()
        {
            var userId = await UserAccessor.GetCurrentIndividualId();

            var individuals        = AccessControlService.GetVisibleIndividuals(userId).Select(i => i.ToWeb());
            var gifts              = AccessControlService.GetVisibleGifts(userId).Select(g => g.ToWeb());
            var giftsWithReceivers = AccessControlService.GetVisibleGiftReceiverPairs(userId);

            return(new DataContext
            {
                IndividualMap = await individuals.ToDictionaryAsync(i => i.Id),
                EventMap = await DbContext.Events.Select(e => e.ToWeb()).ToDictionaryAsync(e => e.Id),
                GiftMap = await gifts.ToDictionaryAsync(g => g.Id),
                GiftReceiverPairs = await giftsWithReceivers.ToListAsync(),
                CurrentUserId = userId
            });
        }