Esempio n. 1
0
        public ActionResult ValidateDomain(string VerificationMethod,
                                           ValidateDomainViewModel validateDomainViewModel)
        {
            bool domainIsValid = false;

            if (VerificationMethod == "Nameserver")
            {
                domainIsValid = this.domainService.VerifyDomainNameNameservers
                                    (validateDomainViewModel.Name + ".com",
                                    Settings.Default.Nameserver1, Settings.Default.Nameserver2);
            }

            if (VerificationMethod == "TxtRecord")
            {
                domainIsValid = this.domainService.VerifyDomainNameByTxtRecord(validateDomainViewModel.Name + ".com");
            }

            if (domainIsValid)
            {
                this.domainService.SendDomainForLogoDesign(validateDomainViewModel.Name + ".com");
                TempData["Success"] = validateDomainViewModel.Name + " sent for logo design successfully!";
            }
            else
            {
                TempData["Error"] = validateDomainViewModel.Name + " failed " + VerificationMethod + " check!";
            }

            return(RedirectToAction("Index"));
        }
        public void ConstructorShouldCreate_ValidateDomainViewModel_WithoutParams()
        {
            // Act & Assert
            var validateDomainViewModel = new ValidateDomainViewModel();

            Assert.IsInstanceOf <ValidateDomainViewModel>(validateDomainViewModel);
        }
        public void ValidateDomainViewModel_Should_Set_Properties_Correctly_With_CorrectData()
        {
            // Arrange
            var id               = 1;
            var name             = "name";
            var verificationCode = "code";

            var validateDomainViewModel = new ValidateDomainViewModel()
            {
                Id               = id,
                Name             = name,
                VerificationCode = verificationCode
            };

            // Act & Assert
            Assert.AreEqual(id, validateDomainViewModel.Id);
            Assert.AreEqual(name, validateDomainViewModel.Name);
            Assert.AreEqual(verificationCode, validateDomainViewModel.VerificationCode);
        }
Esempio n. 4
0
        public ActionResult Validate(string name)
        {
            if (name == null)
            {
                return(RedirectToAction("Index"));
            }

            var domain = this.domainService.GetDomainByName(name + ".com");

            if (domain == null)
            {
                return(RedirectToAction("Index"));
            }
            var validateDomainViewModel = new ValidateDomainViewModel()
            {
                Id               = domain.Id,
                Name             = domain.Name,
                VerificationCode = domain.VerificationCode.ToString().ToUpper()
            };

            return(PartialView(validateDomainViewModel));
        }