예제 #1
0
        public virtual ActionResult Publish(string uuid)
        {
            PagePublishViewModel model = new PagePublishViewModel()
            {
                UUID = uuid, PublishDate = DateTime.Now, OfflineDate = DateTime.Now, PublishTime = "00:00", OfflineTime = "00:00"
            };

            return(View(model));
        }
예제 #2
0
        public virtual ActionResult Publish(string fullName)
        {
            PagePublishViewModel model = new PagePublishViewModel()
            {
                FullName = fullName, PublishDate = DateTime.Now, OfflineDate = DateTime.Now, PublishTime = "00:00", OfflineTime = "00:00"
            };

            return(View(model));
        }
예제 #3
0
        public virtual ActionResult Publish(PagePublishViewModel model, string @return)
        {
            var data = new JsonResultData(ModelState);

            data.RunWithTry((resultData) =>
            {
                if (ModelState.IsValid)
                {
                    var page        = new Page(Site, model.UUID);
                    var publishDate = DateTime.Parse(model.PublishDate.ToShortDateString() + " " + model.PublishTime);
                    var offlineDate = DateTime.Parse(model.OfflineDate.ToShortDateString() + " " + model.OfflineTime);
                    ServiceFactory.PageManager.Publish(page, model.PublishSchedule, model.PublishDraft, model.Period, publishDate, offlineDate, User.Identity.Name);
                }
                resultData.ReloadPage  = true;
                resultData.RedirectUrl = @return;
            });
            return(Json(data));
        }
예제 #4
0
        public virtual ActionResult Publish(PagePublishViewModel model)
        {
            JsonResultEntry entry = new JsonResultEntry();

            try
            {
                if (ModelState.IsValid)
                {
                    var page        = new Page(Site, model.FullName);
                    var publishDate = DateTime.Parse(model.PublishDate.ToShortDateString() + " " + model.PublishTime);
                    var offlineDate = DateTime.Parse(model.OfflineDate.ToShortDateString() + " " + model.OfflineTime);
                    ServiceFactory.PageManager.Publish(page, model.PublishSchedule, model.PublishDraft, model.Period, publishDate, offlineDate, User.Identity.Name);
                }
                entry.RedirectToOpener = true;
                entry.RedirectUrl      = Url.Action("Index", this.ControllerContext.RequestContext.AllRouteValues());
            }
            catch (Exception e)
            {
                entry.AddException(e);
            }

            return(Json(entry));
        }