People controller starter

main
Matt Huntington 5 years ago
parent 0e52d24c9f
commit 0cee6f5309

@ -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 };
}
}
}

@ -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;
}
}
}
Loading…
Cancel
Save