Пример #1
0
        public async Task <ActionResult <IPagedResult <ManualStockOperation> > > BrowseManualStockOperations([FromQuery] BrowseStockOperations query)
        {
            if ((query.StockItemId is null || query.StockItemId.Length == 0) && !(await _authService.IsAdministrator(User)))
            {
                return(Unauthorized(new ErrorDto("unauthorized_resource_access", "Only administrators may view all manual stock operations.")));
            }

            await _stockItemAuthorizationLoader.AssertMultipleResourceAccessAsync(User, query.StockItemId, IsAuthorizedUserPolicy.Instance);

            return(Collection(await _stockOperationsService.BrowseManualStockOperations(query)));
        }
Пример #2
0
 protected override async Task <IEnumerable <Guid> > FindAsync(StockItemIdParameters args)
 => (await _stockOperationsService.BrowseManualStockOperations(new BrowseManualStockOperations()
 {
     StockItemId = new[] { args.StockItemId }
 })).Items.Select(i => i.Id);