private void dataGridType_CellContentClick(object sender, DataGridViewCellEventArgs e) { int id = Convert.ToInt32(dataGridType.Rows[e.RowIndex].Cells[0].Value); selectedType = db.Task_types.Find(id); typeName.Text = selectedType.task_type_name; typeRate.Text = selectedType.task_type_rate.ToString(); }
private void addType_Click(object sender, EventArgs e) { var item = new Task_types(); item.task_type_name = typeName.Text; item.task_type_rate = Convert.ToDouble(typeRate.Text); db.Task_types.Add(item); db.SaveChanges(); fillType(); }