From 31bfeaf5bdda246ab66a8821303d7543b0882943 Mon Sep 17 00:00:00 2001 From: nathan boileau Date: Fri, 27 Jan 2023 16:24:53 +0100 Subject: [PATCH] api controller --- Sources/apiLOL/Controllers/ControllerLol.cs | 43 +++++++++++ Sources/apiLOL/Controllers/LolController.cs | 83 --------------------- 2 files changed, 43 insertions(+), 83 deletions(-) create mode 100644 Sources/apiLOL/Controllers/ControllerLol.cs delete mode 100644 Sources/apiLOL/Controllers/LolController.cs diff --git a/Sources/apiLOL/Controllers/ControllerLol.cs b/Sources/apiLOL/Controllers/ControllerLol.cs new file mode 100644 index 0000000..75c92ad --- /dev/null +++ b/Sources/apiLOL/Controllers/ControllerLol.cs @@ -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/ + [HttpGet] + public IEnumerable Get() + { + return new string[] { "value1", "value2" }; + } + + // GET api//5 + [HttpGet("{id}")] + public string Get(int id) + { + return "value"; + } + + // POST api/ + [HttpPost] + public void Post([FromBody] string value) + { + } + + // PUT api//5 + [HttpPut("{id}")] + public void Put(int id, [FromBody] string value) + { + } + + // DELETE api//5 + [HttpDelete("{id}")] + public void Delete(int id) + { + } + } +} diff --git a/Sources/apiLOL/Controllers/LolController.cs b/Sources/apiLOL/Controllers/LolController.cs deleted file mode 100644 index def4571..0000000 --- a/Sources/apiLOL/Controllers/LolController.cs +++ /dev/null @@ -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(); - } - } - } -}