public IActionResult Put(int id, [FromForm] UserUpdateModel newUser) { if (!ModelState.IsValid || id < 0) { return(BadRequest()); } var currentUser = _business.GetCurrentUser(User); if (currentUser == null) { return(Unauthorized()); } if (currentUser.Id != id) { return(Unauthorized()); } var success = _business.UpdateUserById(id, newUser, currentUser.Id); return(success switch { 1 => (IActionResult)Ok(), 2 => NotFound(), _ => BadRequest() });