public void EditCourse(COURSE course, onQueryComplete onComplete) { ctx.UpdateObject(course); this.onUQC = onComplete; ctx.BeginSaveChanges(onQueryComplete2, null); }
/// <summary> /// Handles the 1 event of the beginButton_Click control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="RoutedEventArgs"/> instance containing the event data.</param> private async void beginButton_Click_1(object sender, RoutedEventArgs e) { Button bt = sender as Button; if (bt.Content.ToString() == "Start Learning!") { Constants.coursing.NavigateToLecture(); } else if (bt.Content.ToString() == "Edit Course") { try { DataServiceQuery<COURSE> dsq = (DataServiceQuery<COURSE>)(from c in ctx.COURSE where c.ID == course.ID select c); TaskFactory<IEnumerable<COURSE>> tf = new TaskFactory<IEnumerable<COURSE>>(); editCourse = (await tf.FromAsync(dsq.BeginExecute(null, null), iar => dsq.EndExecute(iar))).FirstOrDefault(); } catch { ShowMessageDialog("Network connection error.31"); return; } courseTitle.Text = editCourse.TITLE; price.Text = editCourse.PRICE.ToString(); courseContent.Text = editCourse.INTRO; EditCoursePopup.IsOpen = true; } }