create-controller
Create API Controller
Create a controller for a given entity in an ASP.NET Core Web API project.
Pre-requisites
- Use Controller-based APIs
- Use System.Text.Json for all JSON data
- The project uses Entity Framework Core 9 — do not install additional packages, the project is already set up.
Steps
-
Create an empty controller with the naming rule:
{EntityName}Controller -
Set up DI and inject Entity Framework context and
ILogger<T>. -
Do not use Entity Class for model binding. Create DTO classes for each CRUD operation instead.
-
Add CRUD REST API methods with required OpenAPI-related annotations.
-
Add
OperationIdto each action method. Example:// Before [HttpGet] // After [HttpGet(Name = "GetCourses")]Give each
OperationIda meaningful name. -
Apply
[ProducesResponseType]attribute to each action reflecting API behavior. -
Edit
coursemanagement.httpfor testing:- Do not touch the existing
@HostAddressvariable definition. - Use the
HostAddressvariable. - Reference related Entity Class for test payloads.
- When writing POST method, don't add Primary Key from the entity.
- Do not touch the existing
-
Run
dotnet buildto verify everything compiles. -
Add
Swashbuckle.AspNetCore.SwaggerUIpackage:dotnet add package Swashbuckle.AspNetCore.SwaggerUI -
Add the following code to
Program.cs:app.UseSwaggerUI(options => { options.SwaggerEndpoint("/openapi/v1.json", "OpenAPI V1"); }); -
Run
dotnet runto verify the application starts successfully.
More from jim60105/copilot-prompt
chinese-content-writing-guideline
>-
230docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files). Triggers include: any mention of 'Word doc', 'word document', '.docx', or requests to produce professional documents with formatting like tables of contents, headings, page numbers, or letterheads. Also use when extracting or reorganizing content from .docx files, inserting or replacing images in documents, performing find-and-replace in Word files, working with tracked changes or comments, or converting content into a polished Word document. If the user asks for a 'report', 'memo', 'letter', 'template', or similar deliverable as a Word or .docx file, use this skill. Do NOT use for PDFs, spreadsheets, Google Docs, or general coding tasks unrelated to document generation.
140pdf
Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting/decrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.
84rewrite-meeting-audio-transcription
Rewrite raw meeting audio transcriptions into clean, accurate meeting minutes in Traditional Chinese. Use when the user has an unprocessed audio transcription file with recognition errors and needs it cleaned up into proper meeting minutes.
26create-copilot-instructions
Create `AGENTS.md` file for a project. Use when the user wants to set up custom instructions, configure AI coding assistant behavior, or create project-specific coding guidelines for AI agents.
14drawio-diagrams-enhanced
This skill should be used when the user asks to "create a diagram", "draw a flowchart", "make a swimlane diagram", "create WBS", "generate RACI matrix", "build network diagram", "create org chart", or mentions draw.io, diagrams.net, BPMN, UML, Gantt, PERT, or project management diagrams. Integrates with next-ai-draw-io MCP server for real-time diagram creation and editing.
14