Skip to main content

Overview

The Document Management system provides a centralized repository for legal and official documents related to ESP Santa Fe de Antioquia. This feature enables administrators to upload, organize, and publish documents while providing public access to important legal information.

Purpose

This system ensures transparency by making official documents, legal notices, procurement documents, and organizational policies publicly accessible through the website.

User Workflows

1

Admin Creates Document Entry

Administrators create a new document entry with:
  • Document name
  • Project/category name
  • Detailed description
  • Related project selection (e.g., bidding processes)
2

Upload Files

One or more PDF files are uploaded and associated with the document entry. Files are stored in /images/filesDocuments/.
3

Public Access

Citizens browse documents at /documentos-legales and access specific documents using URL-friendly names at /documentos-legales/{urlName}.
4

Download Files

Public users can download PDF files through the secure /documentos-publicos endpoint.

Key Features

Multi-File Support

Each document entry can have multiple PDF files attached

URL-Friendly Access

Automatic generation of SEO-friendly URLs from document names

Version Tracking

Track creation and update dates to monitor document revisions

Project Association

Link documents to specific projects or bidding processes

Data Model

public class Document
{
    public int ID { get; set; }                    // Primary key
    public string Name { get; set; }               // Document title
    public string UrlName { get; set; }            // URL-friendly slug
    public string NameProyect { get; set; }        // Associated project
    public string Description { get; set; }        // HTML description
    public DateTime CreateDate { get; set; }       // Creation timestamp
    public DateTime DateUpdate { get; set; }       // Last update timestamp
    
    // Navigation property
    public IEnumerable<FileDocument> FileDocument { get; set; }
}

File Document Model

public class FileDocument
{
    public int Id { get; set; }
    public int DocumentoId { get; set; }           // Foreign key to Document
    public string FileName { get; set; }           // Original file name
    public string FilePath { get; set; }           // Storage path
    public DateTime UploadDate { get; set; }       // Upload timestamp
}

Controller Actions

Admin Routes

Purpose: Display all documents in admin dashboardAccess: SuperAdmin, AdminFeatures:
  • Sortable list of all documents
  • Quick view of key metadata
  • Actions for edit and delete
[Authorize(Roles = "SuperAdmin,Admin")]
public async Task<IActionResult> Index()
{
    var _documents = from a in await _documentService.GetAll()
                     select new ModelViewDocument
                     {
                        ID = a.ID,
                        Name = a.Name,
                        NameProyect = a.NameProyect,
                        Description = a.Description,
                        CreateDate = a.CreateDate.ToString("MMM dd, yyyy",
                            CultureInfo.CreateSpecificCulture("es-CO"))
                     };
    return View(_documents);
}
Purpose: Add new document entryAccess: SuperAdmin, AdminValidation:
  • Checks for duplicate names
  • Validates file formats (PDF only)
  • Ensures required fields are completed
[Authorize(Roles = "SuperAdmin,Admin")]
[HttpPost]
[ValidateAntiForgeryToken]
public async Task<IActionResult> Create(DocumentCreateDTO model)
{
    if (_documentService.DuplicaName(model.Name))
    {
        ViewData["DuplicaName"] = "El nombre ya esta utilizada, favor cambiarlo";
        return View(model);
    }

    if (ModelState.IsValid)
    {
        await _documentService.Create(model);
        return RedirectToAction(nameof(Index));
    }
    return View(model);
}
Purpose: View document with all attached filesAccess: SuperAdmin, Admin (for integer ID), Public (for URL name)Features:
  • Displays document metadata
  • Lists all attached files
  • Shows update history
  • Indicates if document has been modified
The controller has two overloaded Details methods:
// Admin view by ID
[Authorize(Roles = "SuperAdmin,Admin")]
public async Task<IActionResult> Details(int? id)

// Public view by URL
[Route("documentos-legales/{urlName}")]
public async Task<IActionResult> Details(string urlName)
Purpose: Remove document and associated filesAccess: SuperAdmin, AdminWarning: Deletion is permanent and removes all associated file records.

Public Routes

Purpose: Public listing of all available documentsAccess: Public (no authentication)Features:
  • Grid or list view of documents
  • Filter by project/category
  • Search functionality
  • Direct links to document details
[Route("documentos-legales")]
public async Task<IActionResult> Document()
{
    var _documents = from a in await _documentService.GetAll()
                     select new ModelViewDocument
                     {
                         ID = a.ID,
                         Name = a.Name,
                         UrlName = a.UrlName,
                         NameProyect = a.NameProyect,
                         Description = a.Description,
                         CreateDate = a.CreateDate.ToString("MMM dd, yyyy",
                             CultureInfo.CreateSpecificCulture("es-CO")),
                         FileDocument = a.FileDocument
                     };
    return View(_documents);
}
Purpose: Serve PDF files to usersAccess: PublicSecurity: Files are served from a protected directory with proper MIME types
[AllowAnonymous]
[ActionName("documentos-publicos")]
public FileResult PublicDocuments(string routeFile)
{
    return File($"/images/filesDocuments/{routeFile}", 
                "application/pdf", 
                $"{routeFile}.pdf");
}

Document Categories

Documents are typically organized by project association:

Procurement Documents

Bidding terms, requirements, and specifications linked to procurement processes

Legal Notices

Official announcements, regulations, and compliance documents

Financial Reports

Budget documents, financial statements, and audit reports

Policies & Procedures

Internal policies, operational procedures, and guidelines

Update Tracking

The system automatically tracks document modifications:
var itHasUpdated = false;
if (_document.DateUpdate >= _document.CreateDate)
{
    itHasUpdated = true;
}
This indicator helps users identify recently updated documents and maintains transparency about content changes.

File Storage

PDF files are stored in /wwwroot/images/filesDocuments/ with original filenames preserved. Ensure this directory has appropriate write permissions for the application pool.

Storage Best Practices

  1. Naming Convention: Use descriptive, URL-safe filenames
  2. File Size: Limit PDFs to 10MB for optimal performance
  3. Backup: Regularly backup the filesDocuments directory
  4. Security: Serve files through the controller, not direct file access

Integration with Bidding System

Documents can be linked to bidding processes (NacionLicitante):
ViewData["NameLicitante"] = new SelectList(_context.Masters
    .Where(x => x.NacionLicitante == true)
    .OrderByDescending(x => x.DateCreate), "Id", "NameMaster");
This integration allows procurement documents to be:
  • Associated with specific bidding processes
  • Displayed on bidding detail pages
  • Tracked as part of procurement workflows

SEO Optimization

The system generates URL-friendly slugs from document names:
1

Name Normalization

Document names are converted to lowercase and spaces replaced with hyphens
2

Special Character Handling

Accents and special characters are removed or transliterated
3

URL Generation

Final URL: /documentos-legales/nombre-del-documento

Validation Rules

Required Fields

  • Document name (must be unique)
  • Project name
  • Description
  • At least one PDF file

File Validations

  • Format: PDF only
  • Size: Maximum 10MB per file
  • Multiple files allowed per document

Build docs developers (and LLMs) love