コード例 #1
0
        public ActionResult Manage(PageBinder page)
        {
            if (!this.ModelState.IsValid)
            {
                ManageViewModel model = new ManageViewModel();
                model.Page = page;

                return(this.View(model));
            }

            try
            {
                this.pageService.SaveOrUpdate(page.MapTo <PageDto>());

                this.routingService.UpdateRoutes();
            }
            catch (DexterException e)
            {
                this.Logger.Error("Error during saving the post", e);

                return(this.urlBuilder.Admin.FeedbackPage(FeedbackType.Negative, "UnableToSaveThePost", null).Redirect());
            }

            return(this.urlBuilder.Admin.FeedbackPage(FeedbackType.Positive, "PostSaved", this.urlBuilder.Admin.Page.List()).Redirect());
        }
コード例 #2
0
        public ActionResult Manage(int?id, int?month, int?day, int?year)
        {
            PageBinder post = id.HasValue && id > 0
                                                                  ? (this.pageService.GetPageByKey(id.Value)).MapTo <PageBinder>()
                                                                  : PageBinder.EmptyInstance();

            ManageViewModel model = new ManageViewModel();

            model.Page = post;

            return(this.View(model));
        }
コード例 #3
0
        public ActionResult Manage(PageBinder page)
        {
            if (!this.ModelState.IsValid)
            {
                ManageViewModel model = new ManageViewModel();
                model.Page = page;

                return this.View(model);
            }

            try
            {
                this.pageService.SaveOrUpdate(page.MapTo<PageDto>());

                this.routingService.UpdateRoutes();
            }
            catch (DexterException e)
            {
                this.Logger.Error("Error during saving the post", e);

                return this.urlBuilder.Admin.FeedbackPage(FeedbackType.Negative, "UnableToSaveThePost", null).Redirect();
            }

            return this.urlBuilder.Admin.FeedbackPage(FeedbackType.Positive, "PostSaved", this.urlBuilder.Admin.Page.List()).Redirect();
        }
コード例 #4
0
        public ActionResult Manage(int? id, int? month, int? day, int? year)
        {
            PageBinder post = id.HasValue && id > 0
                                  ? (this.pageService.GetPageByKey(id.Value)).MapTo<PageBinder>()
                                  : PageBinder.EmptyInstance();

            ManageViewModel model = new ManageViewModel();

            model.Page = post;

            return this.View(model);
        }