public ActionResult DeleteCartLine(long cartLineId, CartLine record)
        {
            if (cartLineId != record.Id)
            {
                return(NotFound());
            }
            _repo.Context.OrderId = record.OrderId;
            _repo.Delete(record);
            var shoppingCartRecords = _repo.GetCartLinesByOrder(record.OrderId).ToList();

            _repoOrder.GetTotalPriceAndPersist(record.OrderId, shoppingCartRecords);
            return(NoContent());
        }
        public void ShouldDeleteCartRecordAndUpdateTotalNumberOfItems()
        {
            var item = _cartLineRepo.Find(1);

            _cartLineRepo.Context.Entry(item).State = EntityState.Detached;
            _cartLineRepo.Delete(item);
            Context.OrderId = 1;
            var shoppingCartRecords = _cartLineRepo.GetCartLinesByOrder(Context.OrderId).ToList();

            _orderRepo.GetTotalPriceAndPersist(Context.OrderId, shoppingCartRecords);
            var cartLines = _cartLineRepo.GetAll(x => x.Id).ToList();

            Assert.Equal(2, cartLines[0].Id);
            var order = _orderRepo.GetOrder(Context.OrderId);

            Assert.Equal(825M, order.Total);
        }