public static DocumentInfo ToDocumentInfo(this AddDocumentDto document, IContent content, User currentUser, Folder parentFolder) { if (document == null) { throw new ArgumentNullException(nameof(document)); } if (currentUser == null) { throw new ArgumentNullException(nameof(currentUser)); } return(new DocumentInfo(new DocumentIdentity(document.Id, currentUser.Id), document.FileName, document.ModificationDate, content, parentFolder.Id, parentFolder.ParentsPath.Concat(parentFolder.Id.AsArray()).ToList())); }
public IActionResult Add(AddDocumentDto addDocumentDto) { if (addDocumentDto.AddDocument == null) { return(RedirectToAction("Documents")); } bool result = _documentService.AddDocument(addDocumentDto); if (result) { TempData["DocumentStatus"] = "DocumentAdded"; return(RedirectToAction("Documents")); } TempData["DocumentStatus"] = "DocumentNotAdded"; return(RedirectToAction("Documents")); }
public bool AddDocument(AddDocumentDto addDocumentDto) { try { string uniqueFileName = DocumentHelper.AddDocument(addDocumentDto.AddDocument); Document document = new Document() { PetitionID = addDocumentDto.PetitionID, FileName = addDocumentDto.AddDocument.FileName, DocumentName = uniqueFileName }; bool result = _documentDal.Add(document); return(result); } catch { return(false); } }