Esempio n. 1
0
        public Task <List <SubscriptionReadModel> > Handle(SubscriptionsListQuery request, CancellationToken cancellationToken)
        {
            IQueryable <Subscription>    subscriptions = _subscriptionRepository.Query();
            List <SubscriptionReadModel> subscriptionsListReadModel = null;

            if (subscriptions != null && subscriptions.Any())
            {
                subscriptionsListReadModel = subscriptions.Select(x => new SubscriptionReadModel {
                    Id = x.Id, Name = x.Name
                }).ToList();
            }

            return(Task.FromResult(subscriptionsListReadModel));
        }
Esempio n. 2
0
        public async Task <ActionResult <List <SubscriptionReadModel> > > GetList([FromQuery]  SubscriptionsListQuery query)
        {
            List <SubscriptionReadModel> subscriptions = await _mediator.Send(query);

            return(subscriptions);
        }