Example #1
0
        public ContentModelEdit GetContentEditModel(int contentId)
        {
            var dbModel   = dataManager.Books.GetBookById(contentId);
            var editModel = new ContentModelEdit()
            {
                Id          = dbModel.Id = dbModel.Id,
                DirectoryId = dbModel.DirectoryId,
                Title       = dbModel.Title,
                Html        = dbModel.Html
            };

            return(editModel);
        }
Example #2
0
        public ContentModelView SaveContentEditModelToDb(ContentModelEdit editModel)
        {
            Content content;

            if (editModel.Id != 0)
            {
                content = dataManager.Books.GetBookById(editModel.Id);
            }
            else
            {
                content = new Content();
            }
            content.Title       = editModel.Title;
            content.Html        = editModel.Html;
            content.DirectoryId = editModel.DirectoryId;
            dataManager.Books.SaveBook(content);
            return(ContentDBModelToView(content.Id));
        }
Example #3
0
 public IActionResult SaveMaterial(ContentModelEdit model)
 {
     ServicesManager.Content.SaveContentEditModelToDb(model);
     return(RedirectToAction("PageEditor", "Page", new { pageId = model.Id, pageType = PageType.Content }));
 }