コード例 #1
0
        protected void BtnAdd_Click(object sender, EventArgs e)
        {
            // data input by using ef4

            // create context object
            Models.TaskDBEntities context = new Models.TaskDBEntities();

            // create input object
            Models.TaskList task = new Models.TaskList();
            task.Name        = txtName.Text;
            task.IsComplete  = false;
            task.Priority    = ListPriority.SelectedIndex + 1;
            task.DateCreated = DateTime.Now;

            // data assign into context object
            context.TaskLists.Add(task);

            // execute
            context.SaveChanges();
        }
コード例 #2
0
        protected void BtnAdd_Click(object sender, EventArgs e)
        {
            // data input by using ef4

            // create context object
            Models.TaskDBEntities context = new Models.TaskDBEntities();

            // create input object
            Models.TaskList task = new Models.TaskList();
            task.Name = txtName.Text;
            task.IsComplete = false;
            task.Priority = ListPriority.SelectedIndex + 1;
            task.DateCreated = DateTime.Now;

            // data assign into context object
            context.TaskLists.Add(task);

            // execute
            context.SaveChanges();
        }