public async Task <IHttpActionResult> GetAllAsync(string portalUri, CancellationToken cancellationToken) { var portal = await _portalManager.FindByUriAsync(portalUri, cancellationToken); await ApiSecurity.AuthorizeAsync(portal, AccessPermission.CanView, cancellationToken); var pages = await _portalManager.GetPagesAsync(portal, cancellationToken); if (pages == null) { return(NotFound()); } return(Ok(ModelMapper.ToPageListDto(pages))); }
public async Task <IHttpActionResult> GetByUriAsync(string uri, PortalQueryField fields, CancellationToken cancellationToken) { var portal = await _portalManager.FindByUriAsync(uri, (PortalField)(fields & ~PortalQueryField.Pages), cancellationToken); await ApiSecurity.AuthorizeAsync(portal, AccessPermission.CanView, cancellationToken); return(Ok(ModelMapper.ToPortalDto(portal, fields.HasFlag(PortalQueryField.Pages) ? await _portalManager.GetPagesAsync(portal, cancellationToken) : null))); }