Ejemplo n.º 1
0
        public virtual ActionResult CreateSubSite(CreateSubSiteModel createSiteModel, FormCollection form)
        {
            var data = new JsonResultData(ViewData.ModelState);

            if (ModelState.IsValid)
            {
                data.RunWithTry((resultData) =>
                {
                    Site parentSite = null;
                    if (!string.IsNullOrEmpty(createSiteModel.Parent))
                    {
                        parentSite = new Site(createSiteModel.Parent);
                    }

                    var createdSite = Kooboo.CMS.Sites.Services.ServiceFactory.SiteManager.Create(parentSite, createSiteModel.Name,
                        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);
        }
Ejemplo n.º 2
0
 public virtual ActionResult CreateSubSite(CreateSubSiteModel 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);
 }