public void Put(int id, [FromBody] Syncs newObj) { var oldObj = db.Syncs.Find(id); if (oldObj == null) { return; } newObj.Id = oldObj.Id; db.Entry(oldObj).CurrentValues.SetValues(newObj); db.SaveChanges(); }
private void update(string objects, string dates, string users) { try { //Update(string objects, string dates, string users) _syncs = App.WimeaApp.Syncs.Add(); _syncs.Update(objects, dates, users); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
private void DeleteButton_Click(object sender, RoutedEventArgs e) { Button button = sender as System.Windows.Controls.Button; Syncs syncs = button.DataContext as Syncs; if (MessageBox.Show("Are you sure you want to delete " + syncs.Objects + " ?", "Confirmation", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { syncs.Delete(syncs.Id.ToString()); RefreshStationList(); } else { return; } }
private void save(string objects, string dates, string users) { try { _syncs = App.WimeaApp.Syncs.Add(); _syncs.Objects = objects; _syncs.Dates = dates; _syncs.Users = users; _syncs.Save(); } catch (Exception ex) { MessageBox.Show(ex.Message.ToString()); } }
public void Post(Syncs sync) { db.Syncs.Add(sync); db.SaveChanges(); }