Пример #1
0
        public async Task <ActionResult> Delete([Required] List <Guid> ids, CancellationToken ct = default)
        {
            var suppliers = await _suppliersService.GetListAsync(ids, ct);

            return(await ActionIfAllowed(
                       () => _suppliersService.DeleteAsync(_userContext.UserId, suppliers.Select(x => x.Id), ct),
                       Roles.Suppliers,
                       suppliers.Select(x => x.AccountId)));
        }
Пример #2
0
        public HttpResponseMessage Delete(int id)
        {
            HttpResponseMessage responseMessage;

            try
            {
                service.DeleteAsync(id);
                responseMessage = new HttpResponseMessage(HttpStatusCode.OK);
            }
            catch
            {
                responseMessage = new HttpResponseMessage(HttpStatusCode.NotFound);
            }
            return(responseMessage);
        }