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"); } }
public IActionResult Delete(int id) { var checkOut = _checkOutRepo.GetById(id); if (checkOut == null) { return(NotFound()); } _checkOutRepo.Delete(checkOut); return(NoContent()); }