示例#1
0
        public IActionResult TransferUserAccount([FromBody] TransferUserAccountRequest request)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(request.RequestingModerator) ||
                    string.IsNullOrWhiteSpace(request.OldUsername) || string.IsNullOrWhiteSpace(request.NewUsername))
                {
                    return(BadRequest());
                }

                _moderationService.TransferUserAccount(request.RequestingModerator, request.OldUsername,
                                                       request.NewUsername);

                return(Ok());
            }
            catch (Exception e)
            {
                _logger.LogError(e, $"Error encountered when attempting to Transfer a User Account",
                                 new object[] { request.RequestingModerator, request.OldUsername, request.NewUsername });
            }

            return(BadRequest());
        }