public CustomerOrderWindow(OrderVM currentOrder, OrderService orderService, CustomerService customerService, OrderItemService orderItemService, InventoryItemService inventoryService, MainWindowVM mainVM, EventAggregator eventAggregator) : this() { var order = new Order() { ID = currentOrder.ID, CustomerID = currentOrder.CustomerID, OrderDate = currentOrder.OrderDate, }; var vm = new CustomerOrderVM(eventAggregator, order, orderService, orderItemService, inventoryService, mainVM); vm.RefreshCommand.Execute(null); DataContext = vm; }
public async Task<Order> UpdateAsync(Order entity) { return Update(entity); }
public async Task<Order> InsertAsync(Order entity) { return Insert(entity); }
public Order Update(Order entity) { Debug.WriteLine("UPDATING order in database"); var existing = Orders.First(c => c.ID == entity.ID); Mapper.Map(entity, existing); return entity; }
public Order Insert(Order entity) { Debug.WriteLine("INSERTING order into database"); var nextID = Orders.Any() ? Orders.Max(c => c.ID) + 1 : 1; entity.ID = nextID; Orders.Add(Mapper.Map(entity, new Order())); return entity; }