public async Task CanGetTrainingsList()
        {
            var authorizedClient = SystemTestExtension.GetTokenAuthorizeHttpClient(_factory);

            var getTrainingsListQuery = new GetTrainingsListQueryModel
            {
                Skip = 0,
                Take = 10
            };

            var httpResponse = await authorizedClient.GetAsync(
                requestUri : $"/Training?Skip={getTrainingsListQuery.Skip}&Take={getTrainingsListQuery.Take}");

            httpResponse.EnsureSuccessStatusCode();
            Assert.Equal(HttpStatusCode.OK, httpResponse.StatusCode);
        }
Beispiel #2
0
        public async Task <ActionResult <ResponseModel <TrainingsListModel> > > Get([FromQuery] GetTrainingsListQueryModel query)
        {
            try
            {
                var tenantId = Guid.Parse(Claims[ClaimTypes.UserData]);

                var trainingsListModel = await Mediator.Send(new GetTrainingsListQuery(tenantId, query.Skip, query.Take));

                return(Ok(trainingsListModel));
            }
            catch (NotFoundException)
            {
                return(NotFound());
            }
            catch
            {
                return(StatusCode(HttpStatusCode.InternalServerError.ToInt()));
            }
        }