Skip to content

Instantly share code, notes, and snippets.

@Mgs25
Created August 9, 2022 04:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mgs25/8d99b18d229a93b1d679fc50b803a67b to your computer and use it in GitHub Desktop.
Save Mgs25/8d99b18d229a93b1d679fc50b803a67b to your computer and use it in GitHub Desktop.
[ApiController]
[Authorize]
[Route("[controller]")]
public class StudentController : ControllerBase
{
private static readonly Student[] StudentNames = new[]
{
new Student() {
Name = "Methran",
Age = 19,
Gender = Gender.Male
},
new Student() {
Name = "Sridhar",
Age = 22,
Gender = Gender.Male
},
new Student() {
Name = "Pownraj",
Age = 19,
Gender = Gender.Male
}
};
private readonly ILogger<StudentController> _logger;
public StudentController(ILogger<StudentController> logger)
{
_logger = logger;
}
[HttpGet(Name = "GetWeatherForecast")]
public IEnumerable<Student> Get()
{
return StudentNames.ToArray();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment