private void DeleteButton_Click(object sender, RoutedEventArgs e) { kinectdataEntities con = new kinectdataEntities(); Eventdata eventdataRow = Imported.SelectedItem as Eventdata; var events = (from p in con.Eventdatas where p.Id == eventdataRow.Id select p).Single(); con.Eventdatas.Remove(events); con.SaveChanges(); System.Windows.MessageBox.Show("Record deleted successfully."); GetListData(); }
private void Button_Click(object sender, RoutedEventArgs e) { Eventdata eve = new Eventdata(); eve.@event = txtEvent.Text; eve.eventmsg = txtDes.Text; eve.eventdate = Convert.ToDateTime(datePicker1.Text); eve.eventtime = Convert.ToDateTime(timipicker1.Text); //eve.eventdate =Convert.ToDateTime(Convert.ToDateTime(dtpDate.Text).ToShortDateString()); //eve.eventtime = Convert.ToDateTime(Convert.ToDateTime(dtpTime.Text).ToShortDateString()); //this._context.Events.Add(eve); //this._context.Events.AddObject(eve); //this._context.SaveChanges(); context.Eventdatas.Add(eve); context.SaveChanges(); System.Windows.MessageBox.Show("Record saved successfully."); GetListData(); }