public ActionResult _Update(Customer customer) { var northwind = new NorthwindDataContext(); var target = northwind.Customers.FirstOrDefault(c => c.CustomerID == customer.CustomerID); if (target != null) { target.CompanyName = customer.CompanyName; target.ContactName = customer.ContactName; northwind.SubmitChanges(); } return View(new GridModel(GetCustomers())); }
private IQueryable<Customer> GetCustomers() { var northwind = new NorthwindDataContext(); return northwind.Customers; }