Exemple #1
0
 private void addTopicMenuItem_Click(object sender, EventArgs e)
 {
     var name = "";
     if (InputBox.Show("Topic name:", "Add Topic", ref name) == DialogResult.OK)
     {
         if (!topicsList.Items.Contains(name))
         {
             var topic = new Topic { Name = name };
             namedTopics.Add(name, topic);
             topicsList.Items.Add(name);
             topicsList.SetItemChecked(topicsList.Items.Count - 1, true);
             var db = Context.Instance;
             db.Topics.Add(topic);
             db.SaveChanges();
         }
     }
 }
Exemple #2
0
 public bool Equals(Topic other)
 {
     if (other == null) return false;
     if (IsTransient) return ReferenceEquals(this, other);
     return other.Id == Id;
 }