public void Edit(T entity) { DbEntityEntry dbEntityEntry = _db.Entry(entity); dbEntityEntry.State = EntityState.Modified; _db.SaveChanges(); }
public string ReplenishBalance(int enteredSum) { Account account = db.Accounts.FirstOrDefault(obj => obj.Login == User.Identity.Name); account.Balance += enteredSum; db.Entry(account).State = EntityState.Modified; db.SaveChanges(); return("ok"); }
public void Delete(int id) { var entity = db.Set <T>().Find(id); if (entity != null) { db.Entry(entity).State = EntityState.Deleted; } db.SaveChangesAsync(); }
public void Update(T item) { var itemToModify = _dbSet.Find(item.Id); if (itemToModify == null) { throw new ArgumentException(nameof(item)); } _db.Entry(itemToModify).CurrentValues.SetValues(item); _db.Entry(itemToModify).State = EntityState.Modified; }
public void Update(T item) { var obj = Get(item.Id); Clone(ref obj, item); _context.Entry(obj).State = EntityState.Modified; }
public virtual TEntity Update(TEntity entity) { if (entity == null) { return(null); } _context.Entry(entity).State = EntityState.Modified; return(entity); }
public void Save(TEntity item) { context.Entry(item).State = item.Id == default ? EntityState.Added : EntityState.Modified; context.SaveChanges(); }
public string Update([FromBody] Game game) { db.Entry(game).State = EntityState.Modified; db.SaveChanges(); return("ok"); }
public virtual void Update(TEntity obj) { _db.Entry(obj).State = EntityState.Modified; _db.SaveChanges(); }