public async Task <ActionResult> Delete([Required] List <Guid> ids, CancellationToken ct = default)
        {
            var attributes = await _userCategoriesService.GetListAsync(ids, ct);

            return(await ActionIfAllowed(
                       () => _userCategoriesService.DeleteAsync(_userContext.UserId, attributes.Select(x => x.Id), ct),
                       Roles.Products,
                       attributes.Select(x => x.AccountId)));
        }
        public async Task <ErrorCodeResponse <ProductCategoriesErrorCodesContract> > DeleteAsync(string id,
                                                                                                 [FromBody] DeleteProductCategoryRequest request)
        {
            var result =
                await _productCategoriesService.DeleteAsync(id, request.UserName,
                                                            this.TryGetCorrelationId());

            var response = new ErrorCodeResponse <ProductCategoriesErrorCodesContract>();

            if (result.IsFailed)
            {
                response.ErrorCode =
                    _convertService.Convert <ProductCategoriesErrorCodes, ProductCategoriesErrorCodesContract>(
                        result.Error.GetValueOrDefault());
            }

            return(response);
        }
示例#3
0
        public async Task <ActionResult> DeleteAsync(int id)
        {
            await _productCategoriesService.DeleteAsync(id);

            return(NoContent());
        }