Exemplo n.º 1
0
        /// <summary>
        /// Delete a page
        /// </summary>
        /// <param name="page">Page</param>
        public void DeletePage(Page page)
        {
            if (page == null)
                throw new ArgumentNullException("page");

            if (page.Deleted)
                return;

            _pageRepository.Delete(page);
        }
        private PageModel PrepareListPageModel(Page page)
        {
            var model = page.ToModel();

            model.Actions.Add(new ModelActionLink
            {
                Alt = "Edit",
                Icon = Url.Content("~/Areas/Admin/Content/images/icon-edit.png"),
                Target = Url.Action("edit", new { id = page.Id })
            });

            if(!page.IsSystemPage)
                model.Actions.Add(new DeleteActionLink(page.Id, Search, Page));

            return model;
        }
        public static Page ToEntity(this PageModel model)
        {
            if (model == null)
                return null;

            var entity = new Page
            {
                Content = model.Content,
                Title = model.Title,
                MetaDescription = model.MetaDescription,
                MetaKeywords = model.MetaKeywords,
                MetaTitle = model.MetaTitle,
                Priority = model.Priority
            };

            return entity;
        }
Exemplo n.º 4
0
        /// <summary>
        /// Insert a page
        /// </summary>
        /// <param name="page">page</param>
        public void InsertPage(Page page)
        {
            if (page == null)
                throw new ArgumentNullException("page");

            page.Active = true;
            page.CreatedDate = DateTime.Now;
            page.Deleted = false;
            page.LastModifiedDate = DateTime.Now;

            _pageRepository.Insert(page);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Updates the page
        /// </summary>
        /// <param name="page">page</param>
        public void UpdatePage(Page page)
        {
            if (page == null)
                throw new ArgumentNullException("page");

            page.LastModifiedBy = _workContext.CurrentUser.Id;
            page.LastModifiedDate = DateTime.Now;

            _pageRepository.Update(page);
        }