Esempio n. 1
0
        public ActionResult Employees_Update([DataSourceRequest] DataSourceRequest request, Employee employee)
        {
            if (ModelState.IsValid)
            {
                var entity = new Employee
                {
                    EmpId      = employee.EmpId,
                    FirstName  = employee.FirstName,
                    LastName   = employee.LastName,
                    MiddleName = employee.MiddleName,
                    Phone      = employee.Phone,
                    Salary     = employee.Salary,
                    Email      = employee.Email,
                };

                db.Employees.Attach(entity);
                db.Entry(entity).State = EntityState.Modified;
                db.SaveChanges();
            }

            return(Json(new[] { employee }.ToDataSourceResult(request, ModelState)));
        }
 public void UpdateExcercise(Excercise excercise)
 {
     _entities.Entry(excercise).State = System.Data.Entity.EntityState.Modified;
 }