Пример #1
0
        public async Task <IActionResult> ChangeUsername([FromBody] UsernameChangeViewModel usernameChangeViewModel)
        {
            if (usernameChangeViewModel != null)
            {
                var user = await userManager.GetUserAsync(HttpContext.User);

                AccountResponse response = await accountServices.ChangeUsernameAsync(user, usernameChangeViewModel);

                if (response.ResponseStatus == Status.Success)
                {
                    return(Ok(response.Message));
                }
                else
                {
                    return(StatusCode(StatusCodes.Status400BadRequest, response.Message));
                }
            }
            return(StatusCode(StatusCodes.Status400BadRequest));
        }