Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
People Controller
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
namespace Backend.Controllers
{
[Authorize]
[Route("api/[controller]")]
public class PeopleController : Controller
{
[HttpGet]
public IActionResult Get()
{
return Ok(SampleData.PeopleList);
}
}
}
using System.Collections.Generic;
namespace Backend
{
public static class SampleData
{
public static List<object> PeopleList = new List<object>()
{
new
{
Name = "Master Yoda",
Email = "master@yoda.com",
Id = 1
},
new
{
Name = "Luke Skywalker",
Email = "luke@skywalker.com",
Id = 2
},
new
{
Name = "Darth Vader",
Email = "darth@vader.com",
Id = 3
},
new
{
Name = "Leia Organa",
Email = "leia@organa.com",
Id = 4
},
};
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment