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