Esempio n. 1
0
        public async Task <User> GetByExternalId(string externalId)
        {
            var query = TableQuery.CombineFilters(
                TableQuery.GenerateFilterCondition(nameof(User.PartitionKey), QueryComparisons.Equal, User.EntityPartitionKey),
                TableOperators.And,
                TableQuery.GenerateFilterCondition(nameof(User.ExternalId), QueryComparisons.Equal, externalId)
                );

            var user = await client.GetItemsByTableQuery(new TableQuery <User>().Where(query));

            return(user.HasElements() ? user[0] : null);
        }
Esempio n. 2
0
        public async Task <List <List> > Get(string groupId)
        {
            var query = TableQuery.CombineFilters(
                TableQuery.GenerateFilterCondition("PartitionKey", QueryComparisons.Equal, groupId),
                TableOperators.And,
                TableQuery.GenerateFilterConditionForBool("IsArchieved", QueryComparisons.Equal, false));

            var lists = await client.GetItemsByTableQuery(new TableQuery <List>().Where(query));

            if (lists.IsEmpty())
            {
                return(new List <List>());
            }

            var items = await itemsRepository.GetItems(lists.Select(x => x.Id).ToList());

            return(lists.Select(list =>
            {
                list.Items = items.Where(item => item.ListId == list.Id).ToList();
                return list;
            }).ToList());
        }
Esempio n. 3
0
        public async Task <List <Group> > GetByUserId(string userId)
        {
            var user = await userRepository.Get(userId);

            return(await repository.GetItemsByTableQuery(GetGroupsQuery(user.GroupIdsList.SplitOrDefault())));
        }