// Filtered access: Guest/Admin.
        public async Task <IActionResult> Single([FromRoute] int resourceId)
        {
            await AuthorizeForSingleResource(resourceId);

            var resourceModel = await resService.Get(resourceId);

            var images = resourceModel.Image.Select(x => x.ImagePath).AsEnumerable();

            var resourceDTO = mappService.Map <ResourceMaxDto>(resourceModel);

            resourceDTO.Image = images;

            return(Ok(resourceDTO));
        }
        // Filtered access: Guest/Admin.
        public async Task <IActionResult> Single([FromRoute] int resourceId)
        {
            await AuthorizeForSingleResource(resourceId);

            var resourceModel = await resService.Get(resourceId);

            var resourceDTO = mappService.Map <ResourceMaxDto>(resourceModel);

            return(Ok(resourceDTO));
        }
示例#3
0
 public async Task <IActionResult> Get(Guid id)
 => await ReturnBadRequestIfThrowError(async() => await _resourcesService.Get(id));