Ejemplo n.º 1
0
        public void RemoveItem(string documentId, string cartId)
        {
            CartItem cartItem;
            CheckOut checkOut;

            try
            {
                cartItem = _cartItemRepository.GetCart(documentId, cartId);
            }
            catch (Exception e)
            {
                throw new UnityException("Unable to retrieve cart item", e);
            }

            try
            {
                checkOut = _checkOutRepository.GetCheckOut(cartItem.Document.DocumentId);
            }
            catch (Exception e)
            {
                throw new UnityException("Unable to get check out", e);
            }

            try
            {
                _cartItemRepository.Delete(cartItem);
            }
            catch (Exception e)
            {
                throw new UnityException("Unable to delete cart item", e);
            }

            try
            {
                _checkOutRepository.Delete(checkOut);
            }
            catch (Exception e)
            {
                throw new UnityException("Unable to delete check out");
            }
        }
Ejemplo n.º 2
0
        public IActionResult Delete(int id)
        {
            var checkOut = _checkOutRepo.GetById(id);

            if (checkOut == null)
            {
                return(NotFound());
            }

            _checkOutRepo.Delete(checkOut);

            return(NoContent());
        }