From 284c0911fe5ba8ce6ef08a39f4c310396c282a78 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 21 Feb 2024 15:48:13 +0000 Subject: [PATCH] Adding a new version --- .../Controllers/v1/SomethingV1Controller.cs | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/DoSomethingService/Controllers/v1/SomethingV1Controller.cs b/DoSomethingService/Controllers/v1/SomethingV1Controller.cs index aa5fb06..d8a95b7 100644 --- a/DoSomethingService/Controllers/v1/SomethingV1Controller.cs +++ b/DoSomethingService/Controllers/v1/SomethingV1Controller.cs @@ -7,6 +7,7 @@ namespace DoSomethingService.Controllers.v1; /// [ApiController] [ApiVersion("1.0")] +[ApiVersion("2.0")] [Route("api/v{version:apiVersion}/[controller]")] public class SomethingController : ControllerBase { @@ -21,6 +22,16 @@ public SomethingController(ILogger logger) _logger = logger; } + /// + /// If you need to do something then it will + /// + /// What happened + [HttpGet("DoSomething")] + public string Get() + { + return $"You wanted me to do something, there I did something"; + } + /// /// If you need to do something then, just tell it /// what you want to do @@ -32,7 +43,23 @@ public string Get(string whatToDo) { return $"You wanted me to {whatToDo}, there I did something"; } - + /// + /// If you need to do something then, just tell it + /// what you want to do + /// + /// The thing you want it to do + /// The number of times you want it to do something + /// What happened + [MapToApiVersion("2.0")] + public string Get(string whatToDo, int numberOfTimes) + { + var returnString = ""; + for (int i = 0; i < numberOfTimes; i++) + { + returnString += $"You wanted me to {whatToDo}, there I did something"; + } + return returnString; + } /// /// If you want to post something for it to do ///