Beispiel #1
0
        public void UpdateEntity(string id, T entity)
        {
            //var toUpdate = Table.FirstOrDefault(o => o.Id.ToString() == id);
            //toUpdate = entity;
            //_context.Update(toUpdate);
            //_context.SaveChanges();

            _context.Attach(entity);
            var entry = _context.Entry(entity);

            entry.State = EntityState.Modified;
        }
        public virtual void Update(T entity)
        {
            _context.Attach(entity);
            var entry = _context.Entry(entity);

            entry.State = EntityState.Modified;
            _context.SaveChanges();
        }