You've already forked CsharpTemplate
Add project files.
This commit is contained in:
32
APITemplate/Controllers/ExampleController.cs
Normal file
32
APITemplate/Controllers/ExampleController.cs
Normal file
@ -0,0 +1,32 @@
|
||||
using APITemplate.Models;
|
||||
using APITemplate.Services;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
|
||||
namespace APITemplate.Controllers
|
||||
{
|
||||
public class ExampleController : Controller
|
||||
{
|
||||
private ExampleService _svc;
|
||||
public ExampleController(ExampleService svc)
|
||||
{
|
||||
_svc = svc;
|
||||
}
|
||||
|
||||
// POST: ExampleController/Create
|
||||
[HttpPost]
|
||||
[ValidateAntiForgeryToken]
|
||||
public ActionResult Create(Example e)
|
||||
{
|
||||
try
|
||||
{
|
||||
_svc.Insert(e);
|
||||
return Created("",e);
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user