Ejemplo n.º 1
0
        public async Task <IEnumerable <CountryDto> > GetListAsync([FromBody, BindRequired] NamePartDto namePartDto)
        {
            if (namePartDto == null)
            {
                throw new ArgumentNullException(nameof(namePartDto));
            }
            var currentCulture = _customRequestCultureProvider.DetermineProviderCultureResult(HttpContext);

            return(await _countryService.GetCountryListByNamePartAsync(namePartDto, currentCulture));
        }
Ejemplo n.º 2
0
        public async Task <ActionResult <TripResponse> > GetTripListByUserIdAsync()
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var currentCulture = _customRequestCultureProvider.DetermineProviderCultureResult(HttpContext);

            var login = HttpContext.User.Identity.Name;

            var userAuth = await _authService.GetActiveUserByLoginAsNoTrackingAsync(login);

            if (userAuth.ForceRelogin)
            {
                throw new UnauthorizedException(string.Empty);
            }

            return(await _tripService.GetListByUserIdAsync(userAuth.UserId, currentCulture));
        }