コード例 #1
0
        public async Task <CheckoutResponse> DeleteAsync(int id)
        {
            var existingCheckOut = await _checkoutRepository.FindByIdAsync(id);

            if (existingCheckOut == null)
            {
                return(new CheckoutResponse("Checkout Not Found"));
            }

            try
            {
                _checkoutRepository.Remove(existingCheckOut);
                await _unitOfWork.CompleteAsync();

                return(new CheckoutResponse(existingCheckOut));
            }
            catch (Exception ex)
            {
                return(new CheckoutResponse($"An error occurred when deleting the checkout:{ex.Message}"));
            }
        }