Inheritance: WebSiterViewModel
コード例 #1
0
        public ActionResult Create(CreateWebSiteViewModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var site = new WebSite
            {
                Name        = model.Name,
                Description = model.Description,
                EnableCDNChildApplication  = model.EnableCDNChildApplication,
                EnableTestChildApplication = model.EnableTestChildApplication
            };

            _webSiteRepository.CreateWebSite(site);
            if (model.AddStandardBindings)
            {
                var http = new Binding
                {
                    HostName              = model.HostName,
                    Port                  = 80,
                    Protocol              = "http",
                    IpAddress             = "*",
                    CertificateThumbprint = ""
                };
                var https = new Binding
                {
                    HostName              = model.HostName,
                    Port                  = 443,
                    Protocol              = "https",
                    IpAddress             = "*",
                    CertificateThumbprint = ""
                };
                _webSiteRepository.AddBindingToWebSite(site.Id, http);
                _webSiteRepository.AddBindingToWebSite(site.Id, https);
            }

            return(RedirectToAction("Detail", new { area = ControlPanelAreaRegistration.Name, site.Id }));
        }
コード例 #2
0
        public ActionResult Create(CreateWebSiteViewModel model)
        {
            if (!ModelState.IsValid)
                return View(model);

            var site = new WebSite
            {
                Name = model.Name,
                Description = model.Description,
                EnableCDNChildApplication = model.EnableCDNChildApplication,
                EnableTestChildApplication = model.EnableTestChildApplication
            };
            _webSiteRepository.CreateWebSite(site);
            if (model.AddStandardBindings)
            {
                var http = new Binding
                {
                    HostName = model.HostName,
                    Port = 80,
                    Protocol = "http",
                    IpAddress = "*",
                    CertificateThumbprint = ""
                };
                var https = new Binding
                {
                    HostName = model.HostName,
                    Port = 443,
                    Protocol = "https",
                    IpAddress = "*",
                    CertificateThumbprint = ""
                };
                _webSiteRepository.AddBindingToWebSite(site.Id, http);
                _webSiteRepository.AddBindingToWebSite(site.Id, https);
            }

            return RedirectToAction("Detail", new {area = ControlPanelAreaRegistration.Name, site.Id});
        }