Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class CreateContent : Window
- {
- public IContentService contentService { get; set; }
- public IContentTypeService contentTypeService { get; set; }
- public CreateContent(IContentService contentService, IContentTypeService contentTypeService)
- {
- InitializeComponent();
- this.contentService = contentService;
- this.contentTypeService = contentTypeService;
- PrintContentTypes();
- }
- public void PrintContentTypes()
- {
- List<string> test = new List<string>();
- //We find all ContentTypes so we can show a nice list of everything that is available
- var contentTypes = contentTypeService.GetAllContentTypes();
- foreach (var item in contentTypes)
- {
- test.Add(item.Alias);
- }
- Alias.ItemsSource = test;
- }
- private void bttnSave_Click(object sender, RoutedEventArgs e)
- {
- var contentTypeAlias = Alias.Text;
- var parentId = int.Parse(parentID.Text);
- var contentname = contentName.Text;
- CreateNewContent(contentTypeAlias, parentId, contentname);
- }
- private void CreateNewContent(string contentTypeAlias, int parentID, string contentName)
- {
- var contentObject = this.contentService.CreateContent(contentName, parentID, contentTypeAlias);
- this.contentService.SaveAndPublishWithStatus(contentObject);
- MessageBox.Show("Content saved!");
- //Application.Current.Shutdown();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment