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)); }
public async Task <ActionResult <List <SubscriptionReadModel> > > GetList([FromQuery] SubscriptionsListQuery query) { List <SubscriptionReadModel> subscriptions = await _mediator.Send(query); return(subscriptions); }