Created
November 9, 2019 14:53
-
-
Save AbubakarSiddiq/9ce33e8aabbacd889ed1ba786dacfeff to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Threading.Tasks; | |
using Microsoft.AspNetCore.Mvc; | |
namespace AspNetCoreVersioning.Controllers | |
{ | |
[ApiVersion("1.0")] | |
[Route("api/Values")] | |
[ApiController] | |
public class ValuesV1Controller : ControllerBase | |
{ | |
// GET: api/<controller> | |
[HttpGet] | |
public IEnumerable<string> Get() | |
{ | |
return new string[] { "value one from api version", "One"}; | |
} | |
} | |
[ApiVersion("2.0")] | |
[Route("api/Values")] | |
[ApiController] | |
public class ValuesV2Controller : ControllerBase | |
{ | |
// GET: api/<controller> | |
[HttpGet] | |
public IEnumerable<string> Get() | |
{ | |
return new string[] { "value two from the api version", "two" }; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment