public EditDocumentInfo(Document document) : this() { this.Id = document.Id; this.Key = document.Key; this.Path = document.Path; this.ParentDocument = document.Parent; if (document.Parent != null) { this.ParentId = document.Parent.Id; } this.DocumentType = document.DocumentType; this.CustomField1 = document.CustomField1; this.CustomField2 = document.CustomField2; this.OrderInParent = document.OrderInParent; this.CreatedBy = document.CreatedBy; this.CreatedTime = document.CreatedTime; this.UpdatedBy = document.UpdatedBy; this.UpdatedTime = document.UpdatedTime; }
public EditDocumentInfo(Document document, DocumentTranslation documentTranslation) : this(document) { this.DocumentTranslation = documentTranslation; }
public ActionResult Create(string documentType, int parentId, string culture, FormCollection formCollection) { DocumentType docType = contentService.GetDocumentTypeByName(documentType); Document document = new Document(); document.DocumentType = docType; document.Parent = new Document() { Id = parentId }; Dictionary<string, object> formValue = new Dictionary<string, object>(); foreach (var item in formCollection.AllKeys) { formValue.Add(item, formCollection[item]); } foreach (var item in Request.Files.AllKeys) { formValue.Add(item, Request.Files[item]); } DocumentTranslation documentTranslation = documentTranslationEditor.GetDocumentTranslation(docType, formValue); documentTranslation.Culture = Culture.GetCulture(culture); document.DocumentTranslation = documentTranslation; document.DocumentTranslation.Document = document; try { contentService.CreateDocument(document); return RedirectToAction("ReloadParent", new { reloadDocumentId = parentId, selectDocumentId = document.Id, culture = culture }); } catch (Exception ex) { logger.Error(ex); ModelState.AddBusinessError(ex.Message); } EditDocumentInfo info = new EditDocumentInfo(document, documentTranslation); info.DocumentType = docType; info.Culture = culture; info.CultureDisplayName = new CultureInfo(culture).DisplayName; info.DocumentTranslation = documentTranslation; return RedirectToActionWithError("Create", info, new { documentType = documentType, parentId = parentId, culture = culture }); }