public bool RegisterUserInStore(RegisterUserInStoreDtoCommand command)
        {
            string email    = command.Email.ToLower();
            string pin      = command.Pin;
            string nameUser = command.NameUser;

            int storeId = _storeRepository.GetStoreIdByEmail(email);

            if (storeId == default || storeId == 0)
            {
                return(false);
            }

            return(_userRepository.CreateUserInStore(storeId, pin, nameUser));
        }
        public IActionResult CallAPIRegisUser(string email, string nameUser, string pin)
        {
            email = email.ToLower();
            bool isEmail = _authService.ChechEmail(email);

            if (!isEmail)
            {
                return(RedirectToAction("Error", "Management", new { message = "E-Mail ไม่มีอยู่ในระบบโปรดลงทะเบียนใหม่" }));
            }

            CheckPinDtoCommand checkPinDto = new CheckPinDtoCommand()
            {
                Email = email,
                Pin   = pin
            };
            bool isPin = _authService.CheckPin(checkPinDto);

            if (isPin)
            {
                return(RedirectToAction("Error", "Management", new { message = "Pin นี้ถูกใช้งานในร้านค้านี้เรียบร้อย" }));
            }

            CheckNameUserDtoCommand checkNameUser = new CheckNameUserDtoCommand()
            {
                Email    = email,
                NameUser = nameUser
            };
            bool isName = _authService.ChechNameUser(checkNameUser);

            if (isName)
            {
                return(RedirectToAction("Error", "Management", new { message = "ชื่อพนักงานคนนี้ถูกใช้งานในร้านค้านี้เรียบร้อย" }));
            }

            RegisterUserInStoreDtoCommand command = new RegisterUserInStoreDtoCommand()
            {
                Email    = email,
                NameUser = nameUser,
                Pin      = pin
            };
            bool isRegisUser = _authService.RegisterUserInStore(command);

            if (!isRegisUser)
            {
                return(RedirectToAction("Error", "Management", new { message = "ไม่สามารถเพิ่มพนักงานได้" }));
            }
            return(RedirectToAction("SuccessPage", "Management", new { message = "เพิ่มพนักงานสำเร็จ" }));
        }