mvc entity framework update record code example

Example 1: how to update record using entity framework 5

BY LOVE SINGH.

employeeDBEntities.tblEmployee.Attach(objTblEmployee);
employeeDBEntities.Entry(objTblEmployee).State = EntityState.Modified;
employeeDBEntities.SaveChanges();

Example 2: how to update record using entity framework in c#

public void UpdateCustomer(Customer custDTO)
{
   CustomerEntities ce = new CustomerEntities();
   Customer cust = ce.Customers.Find(custDTO.Id);
   if (cust != null)
   {
    DbEntityEntry ee = ctx.Entry(cust);

Tags:

Misc Example