public async Task <TEntity> UpdateAsync(TEntity entity, CancellationToken cancellationToken) { _dbContext.Entry(entity).State = EntityState.Modified; //? await _dbContext.SaveChangesAsync(cancellationToken); return(entity); }
public ActionResult Edit([Bind(Include = "ID,name,amount")] Budget budget) { if (ModelState.IsValid) { db.Entry(budget).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(budget)); }
public async Task <ActionResult <Budget> > PutBudget(int id, Budget budget) { if (id != budget.Id) { return(BadRequest()); } _context.Entry(budget).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BudgetExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public virtual void Update(T entity) { _db.Entry(entity).State = EntityState.Modified; }