Exemplo n.º 1
0
        public void RemoveCurrentOrder()
        {
            _logger.LogInformation("Moving current order from CurrentOrder to OrderHistory");

            Entities.CurrentOrder entity = _dbContext.CurrentOrder.First();
            _dbContext.CurrentOrder.Remove(entity);
            _dbContext.SaveChanges();
        }
Exemplo n.º 2
0
        public void AddStoreToOrder(Domain.Models.CurrentOrder order)
        {
            _logger.LogInformation("Updating current order with store info of store #{StoreId}", order.StoreId);

            Entities.CurrentOrder currentEntity = _dbContext.CurrentOrder.First();

            //currentEntity.CustomerName = order.CustomerName;
            //currentEntity.CustomerId = order.CustomerId;
            currentEntity.Location = order.Location;
            currentEntity.StoreId  = order.StoreId;

            _dbContext.SaveChanges();
        }
Exemplo n.º 3
0
        public void BeginOrder(Domain.Models.CurrentOrder order)
        {
            _logger.LogInformation("Starting order.");

            Entities.CurrentOrder newEntity = new Entities.CurrentOrder
            {
                CustomerName = order.CustomerName,
                CustomerId   = order.CustomerId,
                TotalPrice   = 0
            };

            _dbContext.CurrentOrder.Add(newEntity);
        }
Exemplo n.º 4
0
        public void AddToOrder(int orderId, int prodId)
        {
            Entities.CurrentOrder order = _dbContext.CurrentOrder
                                          .First();
            Entities.Inventory product = _dbContext.Inventory
                                         .Where(p => p.Id == prodId).SingleOrDefault();

            order.Order      += product.Product + " + ";
            order.TotalPrice += product.Price;

            _dbContext.SaveChanges();

            return;
        }
Exemplo n.º 5
0
        public Domain.Models.CurrentOrder GetCurrentOrder()
        {
            Entities.CurrentOrder      order     = _dbContext.CurrentOrder.First();
            Domain.Models.CurrentOrder newEntity = new Domain.Models.CurrentOrder
            {
                Id           = order.Id,
                CustomerName = order.CustomerName,
                CustomerId   = order.CustomerId,
                Location     = order.Location,
                StoreId      = order.StoreId,
                Order        = order.Order,
                TotalPrice   = order.TotalPrice
            };

            return(newEntity);
        }