// GET: DocType/Delete/5 public ActionResult Delete(Guid id) { var model = new DocTypeViewModel(); model.DocType = DocTypeRepository.Read(id); return(View(model)); }
public void AddDocTypes(IList <Entities.DocType> docTypes) { foreach (Entities.DocType docType in docTypes) { var avm = new DocTypeViewModel(docType); DocTypes.Add(avm); } }
public ActionResult Create(DocTypeViewModel model) { try { var docType = DocTypeRepository.Create(model.DocType.Name, model.DocType.Description, model.DocType.MetaTags); return(RedirectToAction("Index")); } catch { return(View(model)); } }
public ActionResult Edit(DocTypeViewModel model) { try { // TODO: Add update logic here var docType = DocTypeRepository.Update(model.DocType.Id.Value, model.DocType.Name, model.DocType.Description, model.DocType.MetaTags); return(RedirectToAction("Index")); } catch { return(View(model)); } }
public ActionResult Delete(Guid id, FormCollection collection) { try { // TODO: Add delete logic here var model = DocTypeRepository.Delete(id); return(RedirectToAction("Index")); } catch { var model = new DocTypeViewModel(); model.DocType = DocTypeRepository.Read(id); return(View(model)); } }
public DocTypeViewModel GetDocTypeInformation(int id) { var docTypeInfo = new DocTypeViewModel(); var node = ContentService.GetById(id); if (node != null) { var docType = ContentTypeService.GetContentType(node.ContentTypeId); if (docType != null) { docTypeInfo.Description = docType.Description; docTypeInfo.AllowAtRoot = docType.AllowedAsRoot; docTypeInfo.DefaultTemplate = new Template(); if (docType.DefaultTemplate != null) { docTypeInfo.DefaultTemplate.Alias = docType.DefaultTemplate.Alias; docTypeInfo.DefaultTemplate.Id = docType.DefaultTemplate.Id; } var templates = new List <Template>(); foreach (var template in docType.AllowedTemplates) { templates.Add(new Template { Alias = template.Alias, Id = template.Id }); } docTypeInfo.Templates = templates; docTypeInfo.CreatedOn = node.CreateDate.ToString("g"); docTypeInfo.CreatedBy = node.GetCreatorProfile(UserService).Name; docTypeInfo.LastEditedOn = node.UpdateDate.ToString("g"); docTypeInfo.LastEditedBy = node.GetWriterProfile(UserService).Name; docTypeInfo.Status = ContentService.GetById(node.Id).Status; } } return(docTypeInfo); }
// GET: DocType/Create public ActionResult Create() { var model = new DocTypeViewModel(); return(View(model)); }