public ActionResult Create(string documentType, int parentId, string culture) { EditDocumentInfo info = new EditDocumentInfo(); info.ParentId = parentId; info.DocumentType = contentService.GetDocumentTypeByName(documentType); info.Culture = culture; info.CultureDisplayName = new CultureInfo(culture).DisplayName; return View(info); }
public ActionResult Properties(int documentId) { Document document = contentService.GetDocumentById(documentId); EditDocumentInfo info = new EditDocumentInfo(document); return View(info); }
public ActionResult Properties(int documentId, string customField1, string customField2, string key) { Document document = contentService.GetDocumentById(documentId); document.Key = key; document.CustomField1 = customField1; document.CustomField2 = customField2; try { contentService.UpdateDocument(document); return RedirectToAction("Properties", new { documentId = documentId }); } catch (Exception ex) { logger.Error(ex); ModelState.AddBusinessError(ex.Message); } EditDocumentInfo info = new EditDocumentInfo(document); return RedirectToActionWithError("Properties", info, new { documentId = documentId }); }
public ActionResult Edit(int documentId, int documentTranslationId, string culture, FormCollection formCollection) { Document document = contentService.GetDocumentById(documentId); 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(document.DocumentType, formValue); try { documentTranslation.Id = documentTranslationId; contentService.UpdateDocumentTranslation(documentTranslation); return RedirectToAction("ReloadParent", new { reloadDocumentId = document.Parent == null ? 0 : document.Parent.Id, selectDocumentId = document.Id, culture = culture }); } catch (Exception ex) { logger.Error(ex); ModelState.AddBusinessError(ex.Message); } EditDocumentInfo info = new EditDocumentInfo(document, documentTranslation); info.CultureDisplayName = new CultureInfo(culture).DisplayName; info.Culture= culture; return RedirectToActionWithError("Edit", info, new { documentId = documentId, culture = culture }); }
public ActionResult Edit(int documentId, string culture) { logger.Debug("Document: " + documentId); DocumentTranslation documentTranslation = contentService.GetDocumentTranslation(documentId, culture); EditDocumentInfo info = new EditDocumentInfo(documentTranslation.Document, documentTranslation); info.CultureDisplayName = new CultureInfo(culture).DisplayName; info.Culture = culture; return View(info); }
public ActionResult Delete(int documentId, string submitAction) { Document document = contentService.GetDocumentById(documentId); int parentId = document.Parent == null ? 0 : document.Parent.Id; try { if (submitAction.Contains("Cancel")) { return RedirectToAction("Properties", new { documentId = documentId }); } contentService.DeleteDocument(documentId); return RedirectToAction("ReloadParent", new { reloadDocumentId = parentId, selectDocumentId = parentId, culture = GetWorkingCulture() }); } catch (Exception ex) { logger.Error(ex); ModelState.AddBusinessError(ex.Message); } DocumentTranslation documentTranslation = contentService.GetDocumentTranslation(document.Id, GetWorkingCulture()); EditDocumentInfo info = new EditDocumentInfo(); info.Title = documentTranslation.GetDocumentName(); return RedirectToActionWithError("Delete", info, new { documentId = documentId }); }
public ActionResult Delete(int documentId) { Document document = contentService.GetDocumentById(documentId); DocumentTranslation documentTranslation = contentService.GetDocumentTranslation(document.Id, GetWorkingCulture()); EditDocumentInfo info = new EditDocumentInfo(document); info.Title = documentTranslation.GetDocumentName(); return View(info); }
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 }); }