Пример #1
0
        private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e)
        {
            if (NavigationContext.QueryString["id"] != null)
            {
                int.TryParse(NavigationContext.QueryString["id"].ToString(), out id);
                db = new StoryContext("isostore:/Story.sdf");

                _story = (from item in db.diary where item.idStory == id select item).FirstOrDefault();
                 //MessageBox.Show(id.ToString());

                txtReadStory.Text = _story.TextStory;
                txtReadCreated.Text = _story.Created;
                titlePage.Text = _story.Title;
            }
        }
Пример #2
0
        private void btnReadDelete_Click(object sender, EventArgs e)
        {
            if (NavigationContext.QueryString["id"] != null)
            {
                int.TryParse(NavigationContext.QueryString["id"].ToString(), out id);
                db = new StoryContext("isostore:/Story.sdf");

                _story = (from item in db.diary where item.idStory == id select item).FirstOrDefault();

                db.diary.DeleteOnSubmit(_story);
                db.SubmitChanges();

                NavigationService.Navigate(new Uri("/MainPage.xaml", UriKind.Relative));
            }
        }