Пример #1
0
 private void button1_Click(object sender, RoutedEventArgs e)
 {
     using (var db = new KanbanEntities())
     {
         string listname = NewListBox.Text;
         var newie = db.Set<list>();
         newie.Add(new list { Name = listname, CreatedDate = DateTime.Now });
         db.SaveChanges();
         NewListBox.Clear();
         MessageBox.Show("You have added a new list.");
     }
 }
Пример #2
0
        private void button_Click(object sender, RoutedEventArgs e)
        {
            using (var db = new KanbanEntities())
            {
                string data = "";
                foreach (var list in db.lists)
                {

                    data += list.Name + "\n";
                    foreach (var card in list.Cards)
                    {
                        data += card.Text;
                        data += "\n";                   }
                        data += "\n";
                }
                DataBlock.Text = data;

            }
        }
Пример #3
0
        private void button2_Click(object sender, RoutedEventArgs e)
        {
            using (var db = new KanbanEntities())
            {
                int cardlistid = 0 ;
                string cardname = CardNameBox.Text;
                string cardlist = CardListBox.Text;
                var newie = db.Set<Card>();
                var listadd = db.lists.Where(u => u.Name == cardlist);
                foreach (var u in listadd)
                {
                    cardlistid = u.ListId;
                }

                newie.Add(new Card { Text = cardname, CreatedDate = DateTime.Now, ListId = cardlistid });
                db.SaveChanges();
                NewListBox.Clear();
                MessageBox.Show("You have added a new card.");
            }
        }
Пример #4
0
        private void button3_Click(object sender, RoutedEventArgs e)
        {
            using (var db = new KanbanEntities())
            {
                string deletecardname = DeleteCardBox.Text;
                var deletecard = db.Cards.Where(u => u.Text == deletecardname);
                foreach (var u in deletecard)
                {
                    db.Cards.Remove(u);
                }

                db.SaveChanges();
                DeleteCardBox.Clear();
                MessageBox.Show("You have deleted a card.");
            }
        }
Пример #5
0
        private void button4_Click(object sender, RoutedEventArgs e)
        {
            using (var db = new KanbanEntities())
            {
                string deletelistname = DeleteListBox.Text;
                var deletelist = db.lists.Where(u => u.Name == deletelistname);
                foreach (var u in deletelist)
                {
                    db.lists.Remove(u);
                }

                db.SaveChanges();
                DeleteCardBox.Clear();
                MessageBox.Show("You have deleted a list");

            }
        }