示例#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();
         }
     }
 }
示例#2
0
文件: Topic.cs 项目: teamyeah/quizzer
 public bool Equals(Topic other)
 {
     if (other == null) return false;
     if (IsTransient) return ReferenceEquals(this, other);
     return other.Id == Id;
 }