Esempio n. 1
0
        public async Task <IActionResult> GetAll([FromQuery] int?skip, [FromQuery] int?take)
        {
            var maxTake = 100;

            if (take.HasValue && take > maxTake)
            {
                return(BadRequest(new ApiErrorDto {
                    Error = $"You should not ask for more than {maxTake} items in a single request"
                }));
            }

            var inspections = await _inspectionService.GetAllAsync(skip, take);

            var dto = Mapper.Map <InspectionDto[]>(inspections);

            return(Ok(dto));
        }
Esempio n. 2
0
 public IAsyncEnumerable <Inspection> GetInspectionsAsync() => _inspectionService.GetAllAsync();