Exemplo n.º 1
0
        public async Task <IActionResult> ChangeStatusAsync(Guid id)
        {
            try
            {
                var returnId = await _billRepository.DestroyAsync(id);

                return(Ok(new { id = returnId }));
            }
            catch (Exception ex)
            {
                if (ex.Message == "inventory_less_than_input_amount")
                {
                    return(BadRequest(new ExceptionResponse("InventoryException", "inventory_less_than_input_amount")));
                }
                return(BadRequest(new ExceptionResponse(ex.Message)));
            }
        }
Exemplo n.º 2
0
        public async virtual Task <IActionResult> DestroyEntityAsync(Guid id)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(new ApiError(ModelState)));
            }

            try
            {
                var ProductId = await _billRepository.DestroyAsync(id);

                return(Ok(new { id = ProductId }));
            }
            catch (Exception ex)
            {
                return(BadRequest(new ExceptionResponse(ex.Message)));
            }
        }