d1-06-crud-endpoints
Adds the five CRUD REST endpoints (all, detail/{id}, save, update, delete) for an entity to up-api and redeploys. Use when the user asks for Day 1 step 7 of the CRUD drill, or asks to add CRUD API endpoints to up-api. Needs the same entity that was used in the entity-migration step.
How do I install this agent skill?
npx skills add https://github.com/softinter-chiangrai/up-ai-skill-training --skill d1-06-crud-endpointsIs this agent skill safe to install?
- Gen Agent Trust Hubpass
This skill provides standard C# code templates and Docker commands to create and deploy CRUD API endpoints in a local development environment. No security issues were detected.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
What does this agent skill do?
Day 1 · Step 6 — CRUD endpoints, then redeploy
Before starting: Ask which entity to create endpoints for (must match one already migrated in D1_05). Do not assume or proceed without confirmation.
up-api/Controllers/<Entity>sController.cs:
[ApiController]
[Route("api/[controller]")]
public class <Entity>sController : ControllerBase
{
private readonly AppDbContext _db;
public <Entity>sController(AppDbContext db) => _db = db;
[HttpGet]
public async Task<IActionResult> All() => Ok(await _db.<Entity>s.ToListAsync());
[HttpGet("detail/{id}")]
public async Task<IActionResult> Detail(int id)
{
var item = await _db.<Entity>s.FindAsync(id);
return item is null ? NotFound() : Ok(item);
}
[HttpPost("save")]
public async Task<IActionResult> Save(<Entity> input)
{
_db.<Entity>s.Add(input);
await _db.SaveChangesAsync();
return Ok(input);
}
[HttpPut("update/{id}")]
public async Task<IActionResult> Update(int id, <Entity> input)
{
var item = await _db.<Entity>s.FindAsync(id);
if (item is null) return NotFound();
// copy updated fields from input onto item
await _db.SaveChangesAsync();
return Ok(item);
}
[HttpDelete("{id}")]
public async Task<IActionResult> Delete(int id)
{
var item = await _db.<Entity>s.FindAsync(id);
if (item is null) return NotFound();
_db.<Entity>s.Remove(item);
await _db.SaveChangesAsync();
return NoContent();
}
}
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/softinter-chiangrai/up-ai-skill-training/d1-06-crud-endpoints">View d1-06-crud-endpoints on skillZs</a>