public ClientTabViewModel(IDataAccessService dataAccessService, Client currentClient) { _dataAccessService = dataAccessService; _currentClient = currentClient; _originalCurrentClinet = (Client)_currentClient.Clone(); CloseTabCommand = new RelayCommand(closeTab); SaveCurrentCommand = new RelayCommand(saveCurrentClient, canSaveCurrentClientExecute); }
private void btnTest_Click(object sender, RoutedEventArgs e) { Client client = new Client { NameEng = "testUser1" }; using (var context = new EntitiesContext()) { context.Clients.Add(client); context.SaveChanges(); } }
public void SaveClient(Client client) { using (var context = new EntitiesContext()) { if (client.ClientID != 0) { context.Entry(client).State = EntityState.Modified; } else { context.Entry(client).State = EntityState.Added; } context.SaveChanges(); } }
public void SaveClient(Client client) { }
public int AddClient(Client client) { _clients.Add(client); return 1; }
void CloseClientTab(Client client) { var currentTab = (from ctvm in ClientTabVMs where ctvm.CurrentClient.ClientID == client.ClientID select ctvm).FirstOrDefault(); if (currentTab != null) { ClientTabVMs.Remove(currentTab); SelectedClientTabItem = ClientTabVMs.FirstOrDefault(); } }
void OpenNewClientTab() { var newClient = new Client(); this.OpenExistedClientTab(newClient); }
void OpenExistedClientTab(Client client) { var newTab = (from ctvm in ClientTabVMs where ctvm.CurrentClient.ClientID == client.ClientID select ctvm).FirstOrDefault(); if (newTab == null) { newTab = _viewModelLocator.GetClientTabViewModel(client); ClientTabVMs.Add(newTab); } SelectedClientTabItem = newTab; }
public ClientTabViewModel GetClientTabViewModel(Client client) { return _container.Resolve<ClientTabViewModel>(new NamedParameter("currentClient", client)); }
public int AddClient(Client client) { throw new NotImplementedException(); }