public DetachedContentTypeDisplay PostAddDetachedContentType(DetachedContentTypeDisplay contentType) { var detachedContentType = _detachedContentTypeService.CreateDetachedContentType( contentType.EntityType, contentType.UmbContentType.Key, contentType.Name); detachedContentType.Description = contentType.Description; _detachedContentTypeService.Save(detachedContentType); var display = detachedContentType.ToDetachedContentTypeDisplay(); return display; }
public DetachedContentTypeDisplay PutSaveDetachedContentType(DetachedContentTypeDisplay contentType) { var destination = _detachedContentTypeService.GetByKey(contentType.Key); if (destination == null) throw new NullReferenceException("Existing DetachedContentType was not found"); _detachedContentTypeService.Save(contentType.ToDetachedContentType(destination)); return destination.ToDetachedContentTypeDisplay(); }
/// <summary> /// Maps <see cref="DetachedContentTypeDisplay"/> to <see cref="IDetachedContentType"/>. /// </summary> /// <param name="contentType"> /// The content type. /// </param> /// <param name="destination"> /// The destination. /// </param> /// <returns> /// The <see cref="IDetachedContentType"/>. /// </returns> public static IDetachedContentType ToDetachedContentType(this DetachedContentTypeDisplay contentType, IDetachedContentType destination) { destination.Name = contentType.Name; destination.Description = contentType.Description; return(destination); }