api controller

pull/2/head
nathan boileau 2 years ago
parent b59977838a
commit 31bfeaf5bd

@ -0,0 +1,43 @@
using Microsoft.AspNetCore.Mvc;
// For more information on enabling Web API for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
namespace apiLOL.Controllers
{
[Route("api/[controller]")]
[ApiController]
public class ControllerLol : ControllerBase
{
// GET: api/<ControllerLol>
[HttpGet]
public IEnumerable<string> Get()
{
return new string[] { "value1", "value2" };
}
// GET api/<ControllerLol>/5
[HttpGet("{id}")]
public string Get(int id)
{
return "value";
}
// POST api/<ControllerLol>
[HttpPost]
public void Post([FromBody] string value)
{
}
// PUT api/<ControllerLol>/5
[HttpPut("{id}")]
public void Put(int id, [FromBody] string value)
{
}
// DELETE api/<ControllerLol>/5
[HttpDelete("{id}")]
public void Delete(int id)
{
}
}
}

@ -1,83 +0,0 @@
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
namespace apiLOL.Controllers
{
public class LolController : Controller
{
// GET: LolController
public ActionResult Index()
{
return View();
}
// GET: LolController/Details/5
public ActionResult Details(int id)
{
return View();
}
// GET: LolController/Create
public ActionResult Create()
{
return View();
}
// POST: LolController/Create
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Create(IFormCollection collection)
{
try
{
return RedirectToAction(nameof(Index));
}
catch
{
return View();
}
}
// GET: LolController/Edit/5
public ActionResult Edit(int id)
{
return View();
}
// POST: LolController/Edit/5
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Edit(int id, IFormCollection collection)
{
try
{
return RedirectToAction(nameof(Index));
}
catch
{
return View();
}
}
// GET: LolController/Delete/5
public ActionResult Delete(int id)
{
return View();
}
// POST: LolController/Delete/5
[HttpPost]
[ValidateAntiForgeryToken]
public ActionResult Delete(int id, IFormCollection collection)
{
try
{
return RedirectToAction(nameof(Index));
}
catch
{
return View();
}
}
}
}
Loading…
Cancel
Save