internal static MediaType MakeNew(BusinessLogic.User u, string text, int parentId) { var mediaType = new Umbraco.Core.Models.MediaType(parentId) { Name = text, Alias = text, CreatorId = u.Id, Thumbnail = "folder.png", Icon = "folder.gif" }; ApplicationContext.Current.Services.ContentTypeService.Save(mediaType, u.Id); var mt = new MediaType(mediaType.Id); NewEventArgs e = new NewEventArgs(); mt.OnNew(e); return(mt); }
/// <summary> /// Create a new Mediatype /// </summary> /// <param name="u">The Umbraco user context</param> /// <param name="Text">The name of the MediaType</param> /// <returns>The new MediaType</returns> public static MediaType MakeNew(BusinessLogic.User u, string Text) { int ParentId = -1; int level = 1; Guid uniqueId = Guid.NewGuid(); CMSNode n = CMSNode.MakeNew(ParentId, _objectType, u.Id, level, Text, uniqueId); ContentType.Create(n.Id, Text, ""); MediaType mt = new MediaType(n.Id); NewEventArgs e = new NewEventArgs(); mt.OnNew(e); return(mt); }
internal static MediaType MakeNew(BusinessLogic.User u, string text, int parentId) { var mediaType = new Umbraco.Core.Models.MediaType(parentId) { Name = text, Alias = text, CreatorId = u.Id, Thumbnail = "folder.png", Icon = "folder.gif" }; ApplicationContext.Current.Services.ContentTypeService.Save(mediaType, u.Id); var mt = new MediaType(mediaType.Id); NewEventArgs e = new NewEventArgs(); mt.OnNew(e); return mt; }
/// <summary> /// Create a new Mediatype /// </summary> /// <param name="u">The Umbraco user context</param> /// <param name="Text">The name of the MediaType</param> /// <returns>The new MediaType</returns> public static MediaType MakeNew(BusinessLogic.User u, string Text) { int ParentId = -1; int level = 1; Guid uniqueId = Guid.NewGuid(); CMSNode n = CMSNode.MakeNew(ParentId, _objectType, u.Id, level, Text, uniqueId); ContentType.Create(n.Id, Text, ""); MediaType mt = new MediaType(n.Id); NewEventArgs e = new NewEventArgs(); mt.OnNew(e); return mt; }