public async Task <ActionResult <UserViewModel> > AddUser(UserViewModel userViewModel) { try { var result = await _supervisor.AddUserAsync(userViewModel); if (!result.Result || result.Item == null) { return(StatusCode(StatusCodes.Status500InternalServerError, "Error in create User")); } return(CreatedAtRoute("GetUserById", new { userId = result.Item.id }, result.Item)); } catch (Exception ex) { _logger.LogError(ex, "Exception: "); return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }