public async Task <IActionResult> PutUser(int id, [FromBody] UserDto dto) { if (id != dto.Id) { return(BadRequest()); } var user = await _context.Users.FindAsync(id); if (user == null) { return(NotFound()); } dto.ApplyChangesToEntity(user); await _context.SaveChangesAsync(); return(Ok()); }