Categories are the primary way to group products in Tienda Mi Cholo’s inventory. Every product must belong to exactly one category, and the selected category is shown as an amber badge in the product list table. Categories also act as a grouping dimension in the dashboard’s low-stock summary, making it easier to spot which product segments are running low. All authenticated users can view the category list; creating, editing, and deleting categories is restricted to the Administrador and Gerente roles.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/interezante456-pixel/nuevo-proyecto-viernes/llms.txt
Use this file to discover all available pages before exploring further.
Default Categories
The application seeds six categories into the database on first run. These cover the typical product range of a neighborhood convenience store:| ID | Nombre | Descripción |
|---|---|---|
| 1 | Lácteos | Leche, queso, yogurt y derivados |
| 2 | Bebidas | Gaseosas, jugos, agua y bebidas |
| 3 | Snacks | Galletas, papas, dulces y golosinas |
| 4 | Limpieza | Detergentes, lejía, jabones |
| 5 | Abarrotes | Arroz, azúcar, aceite, fideos |
| 6 | Frutas y Verduras | Productos frescos del día |
Category Fields
Each category carries two user-facing fields, as defined in theCategoria model:
The category name shown throughout the system — in the product list badge, the product form dropdown, and the dashboard tables. Maximum 50 characters. Must be unique enough to be meaningful at a glance (e.g., Lácteos, Bebidas).
An optional description of what products belong to this category. Maximum 200 characters. Displayed in the category list table to help staff understand the scope of the category.
ID_Categoria primary key is auto-generated by SQL Server (IDENTITY) and is never entered manually.
Managing Categories
View the category list
Navigate to
/Categoria/Lista. The table displays the ID, name, and description of every category. All authenticated users can access this page.Create a new category
Click Nueva Categoría (visible only to Administrador and Gerente). Fill in:
- NombreCategoria — required, up to 50 characters.
- Descripción — optional, up to 200 characters.
Edit an existing category
Click the Editar button on any category row. The edit form is pre-filled with the current Renaming a category is safe — the
NombreCategoria and Descripcion. Save to persist the changes:ID_Categoria foreign key used in the Producto table does not change.Category in the Product Form
When a user with the Administrador or Gerente role opens the Nuevo Producto or Editar Producto form, the controller loads all categories from the database and passes them to the view:<select> dropdown:
One category per product
The
Categoria_ID foreign key on Producto is not nullable. Every product must be assigned to a category at creation time and must always have one when edited.Category badge in the list
The category name appears as a styled amber badge (
badge-amber) in the Categoría column of the product list, giving staff an instant visual grouping of each item.Access Control Summary
| Operation | Roles allowed |
|---|---|
View category list (Lista) | All authenticated users |
Create category (Nuevo) | Administrador, Gerente |
Edit category (Editar) | Administrador, Gerente |
Delete category (Eliminar) | Administrador, Gerente |
CategoriaController is decorated with [Authorize] at the class level, ensuring unauthenticated users are redirected to the login page. Mutating actions additionally carry [Authorize(Roles = "Administrador,Gerente")].