public void Delete(TEntity entityToDelete) { if (Db.Entry(entityToDelete).State == EntityState.Detached) { DbSet.Attach(entityToDelete); } DbSet.Remove(entityToDelete); }
public async Task UpdateAsync(T entity) { _dbContext.Entry(entity).State = EntityState.Modified; await _dbContext.SaveChangesAsync(); }
public ActionResult Put(int id, [FromBody] Ticket ticket) { context.Entry(ticket).State = EntityState.Modified; context.SaveChanges(); return(Ok()); }