public string Document([System.Web.Http.FromBody] UploadData uploadData) { string folder = Request.Url.GetLeftPart(UriPartial.Authority) + "/Temp/"; DocumentCreator documentCreator = new DocumentCreator(); InformativeExport data = JsonConvert.DeserializeObject <InformativeExport>(uploadData.data); return(documentCreator.Create(folder, data)); }
public async Task InsertAsync(IContent content) { if (content.Id == null) { throw new InvalidOperationException($"This content has no Id. Inserting (sorry for the confusing terminology) is for forcing newly created content to have a set Id. Did you mean to use IContentCreator?"); } var contentType = ContentTypeRepository.Get(content.GetType()); if (contentType == null) { throw new InvalidOperationException($"This content has no content type (or rather its Type ({content.GetType()}) has no [ContentType] attribute)"); } content.ContentTypeId = contentType.Id; await DocumentCreator.Create(ContainerConstants.Content, ContentSerializer.Serialize(content, contentType)); }
public async Task CreateAsync(IContent content, string container) { if (content.Id != null) { throw new InvalidOperationException($"This content seems to already exist as it has a non-null Id ({content.Id}). Did you mean to use IContentUpdater?"); } var contentType = ContentTypeRepository.Get(content.GetType()); if (contentType == null) { throw new InvalidOperationException($"This content has no content type (or rather its Type ({content.GetType()}) has no [ContentType] attribute)"); } content.Id = IdGenerator.Generate(); content.ContentTypeId = contentType.Id; await DocumentCreator.Create(container, ContentSerializer.Serialize(content, contentType)); }
public async Task CreateAsync(IContent content) { if (content.Id != null) { throw new InvalidOperationException($"This content seems to already exist as it has a non-null Id ({content.Id}). Did you mean to use IContentUpdater?"); } var contentType = ContentTypeRepository.Get(content.GetType()); if (contentType == null) { throw new TypeNotRegisteredContentTypeException(content.GetType()); } content.Id = IdGenerator.Generate(); content.ContentTypeId = contentType.Id; foreach (var saveListener in SaveListenerProvider.GetFor(content)) { saveListener.BeforeSave(content); } await DocumentCreator.Create(contentType.Container, ContentSerializer.Serialize(content, contentType)); }