Exemple #1
0
        public async Task <List <EventListVm> > Handle(GetEventsListQuery request, CancellationToken cancellationToken)
        {
            var allEvents = (await _eventRepository.GetAllAsync())
                            .OrderBy(x => x.Date);

            return(_mapper.Map <List <EventListVm> >(allEvents));
        }
Exemple #2
0
        public async Task <List <EventListVm> > Handle(GetEventsListQuery request, CancellationToken cancellationToken)
        {
            var allEvents = await _cleanCodeContext.Events.ToListAsync(cancellationToken);

            var orderedEvents = allEvents.OrderBy(x => x.Date);

            return(_mapper.Map <List <EventListVm> >(orderedEvents));
        }
Exemple #3
0
        public async Task <List <EventListVm> > Handle(GetEventsListQuery request, CancellationToken cancellationToken)
        {
            // Get list of event entities and order by date
            var allEvents = (await _eventRepository.ListAllAsync()).OrderBy(x => x.Date);

            // Use autoMapper to map allEvents entitry list to a list of Events as defined by the view model
            // autoMapper will automatically map properties if they have the same name, if not, a profile can ge used such as MappingPofile.cs
            return(_mapper.Map <List <EventListVm> >(allEvents));
        }
        //Mesajı işleyeceğim yöntemi uyguluyorum..
        public async Task <List <EventListVm> > Handle(GetEventsListQuery request, CancellationToken cancellationToken)
        {
            var allEvents = (await _eventRepository.ListAllAsync()).OrderBy(x => x.Date); //Burada aldığımız tüm varlıkları kullanıcıya döndürmek istemiyorum.

            return(_mapper.Map <List <EventListVm> >(allEvents));                         // Bu sebeple bu satır sadece istediğimiz varlıkları döndürüyor.
        }