Esempio n. 1
0
 private List<Employee> GetEmployees()
 {
     using (_db = new TestMixedVBWithCSharpEntities())
     {
         return _db.Employees.ToList();
     }
 }
Esempio n. 2
0
        protected void listViewTest_ItemUpdating(object sender, ListViewUpdateEventArgs e)
        {
            var id = int.Parse(e.NewValues["Id"].ToString());
            var firstName = e.NewValues["FirstName"].ToString();
            var lastName = e.NewValues["LastName"].ToString();

            using (_db = new TestMixedVBWithCSharpEntities())
            {
                var employee = _db.Employees.SingleOrDefault(emp => emp.ID == id);
                if (employee != null)
                {
                    employee.FirstName = firstName;
                    employee.LastName = lastName;
                    _db.SaveChanges();
                }
            }

            listViewTest.EditIndex = -1;
            PopulateListView();
        }