diff --git a/Controllers/PeopleController.cs b/Controllers/PeopleController.cs new file mode 100644 index 0000000..919c3e7 --- /dev/null +++ b/Controllers/PeopleController.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Logging; + +namespace contacts.Controllers +{ + [ApiController] + [Route("[controller]")] + public class PeopleController : ControllerBase + { + [HttpGet] + public Person[] Get() + { + Person p1 = new Person(1, "Matt", 40); + Person p2 = new Person(2, "Sally", 32); + Person p3 = new Person(3, "Zagthrop", 834); + // Console.WriteLine(p1.name); + return new Person[] { p1, p2, p3 }; + } + } +} diff --git a/Person.cs b/Person.cs new file mode 100644 index 0000000..65fb02f --- /dev/null +++ b/Person.cs @@ -0,0 +1,18 @@ +using System; + +namespace contacts +{ + public class Person + { + public int id { get; set; } + public string name { get; set; } + public int age { get; set; } + public Person(int idParam, string nameParam, int ageParam) + { + + this.id = idParam; + this.name = nameParam; + this.age = ageParam; + } + } +}