Ejemplo n.º 1
0
        public async Task <IActionResult> GetAllLanguages()
        {
            var query    = new GetAllLanguagesQuery();
            var response = await _mediator.Send(query);

            return(response.ToActionResult());
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <IEnumerable <LanguageResource> > > GetLanguages(CancellationToken cancellationToken = default)
        {
            GetAllLanguagesQuery query = new GetAllLanguagesQuery();

            IEnumerable <LanguageResource> languages = await _mediator.Send(query, cancellationToken);

            return(Ok(languages));
        }
Ejemplo n.º 3
0
            public async Task <IEnumerable <LanguageResource> > Handle(GetAllLanguagesQuery request, CancellationToken cancellationToken = default)
            {
                IEnumerable <LanguageResource> languages = await _unitOfWork.Languages
                                                           .GetAll()
                                                           .ProjectTo <LanguageResource>(_mapper.ConfigurationProvider)
                                                           .ToListAsync(cancellationToken);

                return(languages);
            }
Ejemplo n.º 4
0
        public async Task <IEnumerable <LanguageDto> > Handle(GetAllLanguagesQuery request, CancellationToken cancellationToken)
        {
            var languages = await _languageRepository.GetAllAsync();

            return(_mapper.Map <IEnumerable <LanguageDto> >(languages));
        }