Ejemplo n.º 1
0
        public async Task <SenderList> ListSendersAsync(string engagementAccount, DbContinuationToken continuationToken, int count)
        {
            using (var ctx = new EmailServiceDbEntities(this.connectionString))
            {
                var result  = new SenderList();
                var senders = ctx.SenderAddresses.Where(s => s.EngagementAccount == engagementAccount).OrderBy(s => s.Created);
                result.Total = senders.Count();
                if (result.Total <= 0)
                {
                    return(result);
                }

                var taken = count >= 0 ?
                            await senders.Skip(continuationToken.Skip).Take(count).ToListAsync() :
                            await senders.Skip(continuationToken.Skip).ToListAsync();

                result.SenderAddresses = new List <Sender>();
                foreach (var entity in taken)
                {
                    result.SenderAddresses.Add(entity.ToModel());
                }

                if (result.Total > continuationToken.Skip + count)
                {
                    result.NextLink = new DbContinuationToken(continuationToken.DatabaseId, continuationToken.Skip + count);
                }

                return(result);
            }
        }
Ejemplo n.º 2
0
        public SenderList ActionList()
        {
            var action = new SenderList();

            action.Client(client);
            action.Proxy(proxy);

            return(action);
        }