Example #1
0
        public async Task <IActionResult> Delete([FromRoute] int id)
        {
            try
            {
                VerifyUser();

                await _service.DeleteAsync(id);

                return(NoContent());
            }
            catch (Exception e)
            {
                var result = new ResultFormatter(ApiVersion, General.BAD_REQUEST_STATUS_CODE, e.Message).Fail();
                return(StatusCode(General.BAD_REQUEST_STATUS_CODE, result));
            }
        }
        public async Task <ActionResult> Delete(int bookId, int bookOrderNumberId)
        {
            try
            {
                await accountingBookService.DeleteAsync(new AccountingBookDTO { BookId = bookId, BookOrderNumberId = bookOrderNumberId });

                return(NoContent());
            }
            catch (NotFoundException e)
            {
                return(NotFound(new { Id = new { bookId, bookOrderNumberId }, e.Message }));
            }
            catch (DeleteNotPermittedException e)
            {
                return(Conflict(e.Message));
            }
        }