Beispiel #1
0
        public void RemoveOrder(int id)
        {
            Entities.Order customer = _context.Order.Find(id);

            if (customer != null)
            {
                _context.Order.Remove(customer);
                Log.Information($"Order with Id {id} has been removed.");
            }
            else
            {
                Log.Information($"Order with id {id} could not be removed because it does not exist.");
            }
        }
Beispiel #2
0
        public void UpdateOrder(Order order)
        {
            Entities.Order currentOrder = _context.Order.Find(order.OrderId);

            if (order != null)
            {
                Entities.Order newOrder = Mapper.MapOrder(order);

                _context.Entry(currentOrder).CurrentValues.SetValues(newOrder);

                Log.Information($"Order with Id {order.OrderId} has been updated.");
            }
            else
            {
                Log.Debug($"Order with Id {order.OrderId} could not be updated because it does not exist.");
            }
        }