public static void SaveThingsToDo(StartPageViewModel viewModel) { var model = Repository.ThingsToDos.Where(c => c.ID == 1).SingleOrDefault(); if (model != null) { model.ThingsToDo1 = viewModel.ThingsToDo; Repository.SubmitChanges(); } else { var newModel = new ThingsToDo(); newModel.ThingsToDo1 = viewModel.ThingsToDo; Repository.ThingsToDos.InsertOnSubmit(newModel); Repository.SubmitChanges(); } }
private void btnSaveThingsToDo_Click(object sender, RoutedEventArgs e) { var viewmodel = new StartPageViewModel(); viewmodel.ThingsToDo = txtThingsToDo.Text; StudioRepository.SaveThingsToDo(viewmodel); }