public async Task <ObjectResult> SignUp([FromBody] MySignUpModel model)
        {
            try
            {
                MyServiceResult objMyServiceResult = await this._IUserService.SignUp(model);

                return(StatusCode(StatusCodes.Status200OK, JsonSerializer.Serialize <MyServiceResult>(objMyServiceResult)));
            }
            catch (Exception ex)
            {
                return(StatusCode(StatusCodes.Status400BadRequest, JsonSerializer.Serialize <MyServiceResult>(new MyServiceResult
                {
                    Successed = false,
                    Content = ex.Message
                })));
            }
        }
        public async Task <MyServiceResult> SignUp(MySignUpModel model)
        {
            try
            {
                if (model is null)
                {
                    return(new MyServiceResult
                    {
                        Successed = false,
                        Content = "Lỗi đăng ký"
                    });
                }

                MyIdentityUser objMyIdentityUserFind = await this._UserManager.FindByNameAsync(model.UserName);

                if (objMyIdentityUserFind is null)
                {
                    MyIdentityUser objMyIdentityUserCreate = this._IMapper.Map <MyIdentityUser>(model);
                    IdentityResult objIdentityResult       = await this._UserManager.CreateAsync(objMyIdentityUserCreate, model.Password);

                    if (objIdentityResult.Succeeded)
                    {
                        string roleName = "";
                        if (string.IsNullOrWhiteSpace(model.RoleId))
                        {
                            string formatRoleString = model.RoleName.CapitalizeSentences();
                            bool   existsRole       = await this._RoleManager.RoleExistsAsync(formatRoleString);

                            if (existsRole == false)
                            {
                                await this._RoleManager.CreateAsync(new MyIdentityRole
                                {
                                    Name = model.RoleName
                                });

                                roleName = formatRoleString;
                            }
                        }
                        else
                        {
                            MyIdentityRole objMyIdentityRole = await this._RoleManager.FindByIdAsync(model.RoleId);

                            if (objIdentityResult is null)
                            {
                                return(new MyServiceResult
                                {
                                    Successed = false,
                                    Content = "Đăng ký thất bại"
                                });
                            }
                            roleName = objMyIdentityRole.Name;
                        }
                        IdentityResult objIdentityResultAddRole = await this._UserManager.AddToRoleAsync(objMyIdentityUserCreate, roleName);

                        if (objIdentityResultAddRole.Succeeded)
                        {
                            return(new MyServiceResult
                            {
                                Successed = true,
                                Content = "Đăng ký thành công"
                            });
                        }
                        else
                        {
                            return(new MyServiceResult
                            {
                                Successed = false,
                                Content = "Đăng ký thất bại"
                            });
                        }
                    }
                    else
                    {
                        return(new MyServiceResult
                        {
                            Successed = false,
                            Content = "Đăng ký thất bại"
                        });
                    }
                }
                else
                {
                    return(new MyServiceResult
                    {
                        Successed = false,
                        Content = "Người dùng đã tồn tại"
                    });
                }
            }
            catch (Exception)
            {
                throw;
            }
        }