public async Task <IActionResult> PutSession([FromRoute] long id, [FromBody] Session session) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != session.ChatId) { return(BadRequest()); } _context.Entry(session).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!SessionExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }