public void SaveProfile() { try { var profilesDictionary = profiles.ToDictionary(p => p.ProfilesId); if (SelectedProfile != null) { profileCommand.Upsert(SelectedProfile); profiles.Clear(); profiles.AddRange(profileCommand.GetList()); UpdateAppStatus("Profile Saved"); } } catch (Exception ex) { UpdateAppStatus(ex.Message); } }
public MainViewModel() { SelectedProfile = new ProfileModel(); //pulls models from external source but no logic which collections are for try { profileCommand = new ProfileCommand(_connectionString); //list that comes from the database will be added to Emplyees Bindable collection Profiles.AddRange(profileCommand.GetList()); EmployeeCommand employeeCommand = new EmployeeCommand(_connectionString); //list that comes from the database will be added to Emplyees Bindable collection Employees.AddRange(employeeCommand.GetList()); CompanyCommand companyCommand = new CompanyCommand(_connectionString); //list that comes from the database will be added to Emplyees Bindable collection Companies.AddRange(companyCommand.GetList()); } catch (Exception ex) { AppStatus = ex.Message; NotifyOfPropertyChange(() => AppStatus); } }