public OrderViewModel(GenericService <Order> orderService, GenericService <Room> roomService, GenericService <Client> clientService, GenericService <Service> serviceService) { service = orderService; this.roomService = roomService; this.clientService = clientService; this.serviceService = serviceService; WorkingItem = new Order(); finishOrderCommand = new DelegateCommand((o) => { if (SelectedItem == null) { return; } SelectedItem.FinishOrder(); service.Update(SelectedItem); SelectedItem.Room.State = RoomState.Free; roomService.Update(SelectedItem.Room); NotifyPropertyChanged("Items"); Update(); }); useServiceCommand = new DelegateCommand((o) => { if (SelectedItem == null || SelectedItem.EndDate == null || Service == null) { return; } SelectedItem.UseService(Service); service.Update(SelectedItem); NotifyPropertyChanged("Items"); }); }