コード例 #1
0
        public async Task <IEnumerable <Event> > Handle(FindEventsBySearchQuery request, CancellationToken cancellationToken)
        {
            var filterContainer = new FilterContainer <Models.Event>();

            if (request.Name != null)
            {
                filterContainer.AddFilterCondition(p => p.Name == request.Name);
            }

            if (request.Category != null)
            {
                filterContainer.AddFilterCondition(p => p.Category == request.Category);
            }

            var filter = filterContainer.GetFilter();

            var result = await _eventRepository.GetAllAsync(filter);

            return(result.Select(e => e.ToDto()));
        }