public void CreateUserWithRole(CreateUserPanelWithRoleCommand command)
        {
            var user           = new PanelUser(command.UserName, command.FirstName, command.LastName, command.NationalCode, command.MobileNumber, command.Email);
            var identityResult = _panelRepository
                                 .RegisterUserWithRole(user, new IdentityRole(command.RoleName), command.Password).Result;

            if (identityResult == null)
            {
                throw new CustomException(" Internal Server Error");
            }
            if (!identityResult.Succeeded)
            {
                throw new CustomException(identityResult.Errors.Aggregate("",
                                                                          (current, error) => current + error + "\n"));
            }
        }
 public IHttpActionResult Post(CreateUserPanelWithRoleCommand command)
 {
     try
     {
         _panelSecutiytCommandService.CreateUserWithRole(command);
         return(Ok(new ResponseModel
         {
             Message = "ثبت نام کاربر با موفقیت انجام شد",
             Success = true,
         }));
     }
     catch (Exception e)
     {
         return(Ok(new ResponseModel
         {
             Message = e.Message,
             Success = false,
         }));
     }
 }