コード例 #1
0
        public ActionResult PublishPopup_POST(string popupID, GalleryPublicationPeriodModel model)
        {
            if (this.CurrentUser == null)
                this.RedirectToLoginPage();

            if (!this.ModelState.IsValid)
            {
                this.ViewBag.PopupID = popupID;
                return this.PartialView("GalleryPublishPopup", model);
            }

            var result = GalleryRuntime.PublishGallery(this.CurrentUser.ID, model.GalleryID,
                DateTime.ParseExact(model.From, DateTimeFormat, this.UserCulture).ToUniversalTime(),
                string.IsNullOrEmpty(model.To) ? (DateTime?)null : DateTime.ParseExact(model.To, DateTimeFormat, this.UserCulture).ToUniversalTime());

            switch(result)
            {
                case OperationResults.Success:
                    return this.Json(new { success = true });
                case OperationResults.NotFound:
                    return this.Json(new { success = false, error = "Gallery was not found" });
                case OperationResults.Failure:
                    return this.Json(new { success = false, error = "Server error" });
            }

            throw new NotImplementedException();
        }
コード例 #2
0
        public ActionResult PublishPopup_GET(string popupID, int galleryID)
        {
            if (this.CurrentUser == null)
                this.RedirectToLoginPage();

            var model = new GalleryPublicationPeriodModel() { GalleryID = galleryID, From = DateTime.Now.ToString(DateTimeFormat, this.UserCulture) };
            this.ViewBag.PopupID = popupID;

            return this.PartialView("GalleryPublishPopup", model);
        }