Esempio n. 1
0
        private void ClickEditBelief(object o)
        {
            EditBeliefWindow beliefDialog = new EditBeliefWindow();

            beliefDialog.BeliefValue          = SelectedBelief.Belief;
            beliefDialog.cbTopic.ItemsSource  = Topics;
            beliefDialog.cbTopic.SelectedItem = SelectedTopic;
            beliefDialog.ShowDialog();
            if (beliefDialog.DialogResult == true)
            {
                SelectedBelief.TopicId = beliefDialog.TopicValue.Id;
                SelectedBelief.Belief  = beliefDialog.BeliefValue;
                BibleBeliefsRepository.UpdateBelief(_SelectedBelief);
            }
            Beliefs = BibleBeliefsRepository.GetBeliefs(_SelectedTopic.Id);
        }
Esempio n. 2
0
        private void ClickNewBelief(object o)
        {
            EditBeliefWindow beliefDialog = new EditBeliefWindow();

            beliefDialog.BeliefValue = "";
            beliefDialog.ShowDialog();
            if (beliefDialog.DialogResult == true)
            {
                BeliefDTO belief = new BeliefDTO()
                {
                    Belief  = beliefDialog.BeliefValue,
                    TopicId = SelectedTopic.Id
                };
                long newId = BibleBeliefsRepository.CreateBelief(belief);
                Beliefs = BibleBeliefsRepository.GetBeliefs(SelectedTopic.Id);
                var b = Beliefs.Single(s => s.Id == newId);
                if (b != null)
                {
                    SelectedBelief = b;
                }
            }
        }