Exemplo n.º 1
0
        public async Task <IActionResult> RequestEmailChange([FromBody] EmailChangeViewModel emailChangeViewModel)
        {
            if (emailChangeViewModel != null)
            {
                var user = await userManager.GetUserAsync(HttpContext.User);

                AccountResponse response = await accountServices.ChangeEmailAsync(user, emailChangeViewModel);

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