Skip to content

Instantly share code, notes, and snippets.

@AbubakarSiddiq
Created November 9, 2019 14:53
Show Gist options
  • Save AbubakarSiddiq/9ce33e8aabbacd889ed1ba786dacfeff to your computer and use it in GitHub Desktop.
Save AbubakarSiddiq/9ce33e8aabbacd889ed1ba786dacfeff to your computer and use it in GitHub Desktop.
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