Exemple #1
0
        public virtual void Update(TEntity entity)
        {
            var local = _context.Set <TEntity>()
                        .Local
                        .FirstOrDefault(entry => entry.Id.Equals(entity.Id));

            if (local != null)
            {
                _context.Entry(local).State = EntityState.Detached;
            }

            _context.Entry(entity).State = EntityState.Modified;
            //_context.Entry(currentData).CurrentValues.SetValues(entity);
            // _context.Entry(entity).State = EntityState.Modified;
        }
 public ActionResult Edit([Bind(Include = "EmployeeCode,EmployeePassword")] Employee employee)
 {
     if (ModelState.IsValid)
     {
         db.Entry(employee).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(employee));
 }