Skip to content

Commit

Permalink
Adding a new version
Browse files Browse the repository at this point in the history
  • Loading branch information
peter committed Feb 21, 2024
1 parent 2f209da commit 284c091
Showing 1 changed file with 28 additions and 1 deletion.
29 changes: 28 additions & 1 deletion DoSomethingService/Controllers/v1/SomethingV1Controller.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ namespace DoSomethingService.Controllers.v1;
/// </summary>
[ApiController]
[ApiVersion("1.0")]
[ApiVersion("2.0")]
[Route("api/v{version:apiVersion}/[controller]")]
public class SomethingController : ControllerBase
{
Expand All @@ -21,6 +22,16 @@ public SomethingController(ILogger<SomethingController> logger)
_logger = logger;
}

/// <summary>
/// If you need to do something then it will
/// </summary>
/// <returns>What happened</returns>
[HttpGet("DoSomething")]
public string Get()
{
return $"You wanted me to do something, there I did something";
}

/// <summary>
/// If you need to do something then, just tell it
/// what you want to do
Expand All @@ -32,7 +43,23 @@ public string Get(string whatToDo)
{
return $"You wanted me to {whatToDo}, there I did something";
}

/// <summary>
/// If you need to do something then, just tell it
/// what you want to do
/// </summary>
/// <param name="whatToDo">The thing you want it to do</param>
/// <param name="numberOfTimes">The number of times you want it to do something</param>
/// <returns>What happened</returns>
[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;
}
/// <summary>
/// If you want to post something for it to do
/// </summary>
Expand Down

0 comments on commit 284c091

Please sign in to comment.