public ActionResult EditCharacter(CharacterDB character, int id) { if (ModelState.IsValid) { db.Entry(character).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(character)); }
public async Task <TEntity> UpdateAsync(TEntity entity) { var currentEntity = await GetByIdAsync(entity.Id).ConfigureAwait(false); EntityContext.Entry(currentEntity).CurrentValues.SetValues(entity); await EntityContext.SaveChangesAsync(); return(entity); }
public Task Update(T entity) { // In case AsNoTracking is used _context.Entry(entity).State = EntityState.Modified; return(_context.SaveChangesAsync()); }