Skip to content

Instantly share code, notes, and snippets.

@cdennig
Last active September 6, 2017 19:02
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 cdennig/63f1bab3633e509b3e6c92a2779276bb to your computer and use it in GitHub Desktop.
Save cdennig/63f1bab3633e509b3e6c92a2779276bb to your computer and use it in GitHub Desktop.
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