public void BlockCard(long number, DateTime expiresEnd, ushort CVV)
        {
            Card temp = GetCard(number, expiresEnd, CVV);

            CheckCardOperationsByExeption(number, expiresEnd, CVV);

            temp.IsBlocked = true;

            _dbContext.Update(temp);
            _dbContext.SaveChanges();
        }
Exemplo n.º 2
0
        public void AddCart(CardCreationDto card, int amount)
        {
            var shoppingCartItem = new ShoppingCartItemDto
            {
                ShoppingCartID = ShoppingCartId,
                CardCreation   = card,
                Amount         = amount
            };

            _Context.ShoppingCartItems.Add(shoppingCartItem);


            _Context.SaveChanges();
        }
        public void CreateOrder(Order order)
        {
            order.OrderPlaced = DateTime.Now;
            _context.Orders.Add(order);
            var shoppingCartItems = _shoppingCart.ShoppingCartItems;

            foreach (var shoppingCart in shoppingCartItems)
            {
                var OrderDetails = new OrderDetail()
                {
                    Amount  = shoppingCart.Amount,
                    card    = shoppingCart.CardCreation,
                    OrderId = order.OrderId
                };

                _context.OrderDetails.Add(OrderDetails);
            }

            _context.SaveChanges();
        }