Example #1
0
 public virtual ActionResult CreateSubSite(CreateSiteModel model)
 {
     string siteName = Request["siteName"] ?? Request["parent"];
     if (!string.IsNullOrWhiteSpace(siteName))
     {
         var parentSite = SiteHelper.Parse(siteName).AsActual();
         model.Repository = parentSite.Repository;
     }
     ModelState.Clear();
     return View(model);
 }
Example #2
0
        public virtual ActionResult Create(CreateSiteModel createSiteModel)
        {
            var data = new JsonResultData(ViewData.ModelState);

            if (ModelState.IsValid)
            {
                data.RunWithTry((resultData) =>
                {
                    var siteTemplate = _siteTemplateManager.GetItemTemplate(null, createSiteModel.Template);

                    if (siteTemplate != null)
                    {
                        var createdSite = Kooboo.CMS.Sites.Services.ServiceFactory.SiteManager.Create(null, createSiteModel.Name, siteTemplate.TemplateFile,
                            new CreateSiteOptions()
                            {
                                Culture = createSiteModel.Culture,
                                MembershipName = createSiteModel.Membership,
                                RepositoryName = createSiteModel.Repository,
                                TimeZoneId = createSiteModel.TimeZoneId,
                                UserName = User.Identity.Name
                            });

                        resultData.RedirectUrl = Url.Action("SiteMap", new { controller = "Home", siteName = createdSite.FullName });
                    }
                });
            }

            return Json(data);
        }
Example #3
0
        public virtual ActionResult CreateSubSite()
        {
            string siteName = Request["siteName"] ?? Request["parent"];
            var createSiteModel = new CreateSiteModel() { Version = "1.0.0.0" };
            if (!string.IsNullOrWhiteSpace(siteName))
            {
                //createSiteModel.Parent = siteName;
                var parentSite = SiteHelper.Parse(siteName).AsActual();
                createSiteModel.Repository = parentSite.Repository;
                createSiteModel.Theme = parentSite.Theme;
                createSiteModel.Version = parentSite.Version;
            }

            return View(createSiteModel);
        }