/// <summary> /// Default constructor. Creates a new model. /// </summary> /// <param name="isfolder">Whether this is a folder or not.</param> public EditModel(bool isfolder, Guid parentid) { Content = new Piranha.Models.Content() { IsFolder = isfolder, ParentId = parentid }; ContentCategories = new List <Guid>(); Categories = new MultiSelectList(Category.GetFields("category_id, category_name", new Params() { OrderBy = "category_name" }), "Id", "Name"); var folders = Content.GetFields("content_id, content_name", "content_folder=1 AND content_draft=1", new Params() { OrderBy = "content_name" }); folders.Insert(0, new Content()); Extensions = Content.GetExtensions(true); Folders = SortFolders(Content.GetFolderStructure(false)); Folders.Insert(0, new Placement() { Text = "", Value = Guid.Empty }); }
/// <summary> /// Default constructor. Creates a new model. /// </summary> /// <param name="isfolder">Weather this is a folder or not.</param> public EditModel(bool isfolder, Guid parentid) { Content = new Piranha.Models.Content() { IsFolder = isfolder, ParentId = parentid }; ContentCategories = new List <Guid>(); Categories = new MultiSelectList(Category.GetFields("category_id, category_name", new Params() { OrderBy = "category_name" }), "Id", "Name"); var folders = Content.GetFields("content_id, content_name", "content_folder=1", new Params() { OrderBy = "content_name" }); folders.Insert(0, new Content()); if (Content.ParentId == Guid.Empty) { Folders = new SelectList(folders, "Id", "Name"); } else { Folders = new SelectList(folders, "Id", "Name", Content.ParentId); } }
/// <summary> /// Default constructor. Creates a new model. /// </summary> /// <param name="isfolder">Whether this is a folder or not.</param> public EditModel(bool isfolder, Guid parentid) { Content = new Piranha.Models.Content() { IsFolder = isfolder, ParentId = parentid } ; ContentCategories = new List<Guid>() ; Categories = new MultiSelectList(Category.GetFields("category_id, category_name", new Params() { OrderBy = "category_name" }), "Id", "Name") ; var folders = Content.GetFields("content_id, content_name", "content_folder=1 AND content_draft=1", new Params() { OrderBy = "content_name" }) ; folders.Insert(0, new Content()) ; Extensions = Content.GetExtensions() ; Folders = SortFolders(Content.GetFolderStructure(false)) ; Folders.Insert(0, new Placement() { Text = "", Value = Guid.Empty }) ; }
/// <summary> /// Default constructor. Creates a new model. /// </summary> /// <param name="isfolder">Weather this is a folder or not.</param> public EditModel(bool isfolder, Guid parentid) { Content = new Piranha.Models.Content() { IsFolder = isfolder, ParentId = parentid } ; ContentCategories = new List<Guid>() ; Categories = new MultiSelectList(Category.GetFields("category_id, category_name", new Params() { OrderBy = "category_name" }), "Id", "Name") ; var folders = Content.GetFields("content_id, content_name", "content_folder=1", new Params() { OrderBy = "content_name" }) ; folders.Insert(0, new Content()) ; if (Content.ParentId == Guid.Empty) Folders = new SelectList(folders, "Id", "Name") ; else Folders = new SelectList(folders, "Id", "Name", Content.ParentId) ; }