public async Task <object> Post(UpdateStartupUser request) { var user = _userManager.Users.First(); // TODO: This should be handled internally by xbmc metadata const string metadataKey = "xbmcmetadata"; var metadata = _config.GetConfiguration <XbmcMetadataOptions>(metadataKey); metadata.UserId = user.Id.ToString("N"); _config.SaveConfiguration(metadataKey, metadata); user.Name = request.Name; await _userManager.UpdateUser(user).ConfigureAwait(false); var result = new UpdateStartupUserResult(); if (!string.IsNullOrWhiteSpace(user.ConnectUserName) && string.IsNullOrWhiteSpace(request.ConnectUserName)) { await _connectManager.RemoveConnect(user.Id.ToString("N")).ConfigureAwait(false); } else if (!string.Equals(user.ConnectUserName, request.ConnectUserName, StringComparison.OrdinalIgnoreCase)) { result.UserLinkResult = await _connectManager.LinkUser(user.Id.ToString("N"), request.ConnectUserName).ConfigureAwait(false); } return(result); }
public async Task <object> Post(UpdateStartupUser request) { var user = _userManager.Users.First(); user.Name = request.Name; _userManager.UpdateUser(user); var result = new UpdateStartupUserResult(); return(result); }
public async Task <object> Post(UpdateStartupUser request) { var user = _userManager.Users.First(); user.Name = request.Name; _userManager.UpdateUser(user); if (!string.IsNullOrEmpty(request.Password)) { await _userManager.ChangePassword(user, request.Password).ConfigureAwait(false); } var result = new UpdateStartupUserResult(); return(result); }
public async Task <object> Post(UpdateStartupUser request) { var user = _userManager.Users.First(); user.Name = request.Name; _userManager.UpdateUser(user); var result = new UpdateStartupUserResult(); if (!string.IsNullOrWhiteSpace(user.ConnectUserName) && string.IsNullOrWhiteSpace(request.ConnectUserName)) { await _connectManager.RemoveConnect(user.Id.ToString("N")).ConfigureAwait(false); } else if (!string.Equals(user.ConnectUserName, request.ConnectUserName, StringComparison.OrdinalIgnoreCase)) { result.UserLinkResult = await _connectManager.LinkUser(user.Id.ToString("N"), request.ConnectUserName).ConfigureAwait(false); } return(result); }