public async Task <IActionResult> PutUserSettings(int id, UserSettings userSettings) { if (id != userSettings.Id) { return(BadRequest()); } _context.Entry(userSettings).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!UserSettingsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public void UpdatEntity(T t) { var entry = _context.Entry(t); _context.Set <T>().Attach(t); entry.State = EntityState.Modified; _context.SaveChanges(); }