Answers for ""Rest Api's in Asp.Net and C#""

C#
1

rest api in c#

[ApiController]
public class PeopleController : ControllerBase
{
    [HttpGet("people/all")]
    public ActionResult<IEnumerable<Person>> GetAll()
    {
        return new []
        {
            new Person { Name = "Ana" },
            new Person { Name = "Felipe" },
            new Person { Name = "Emillia" }
        };
    }
}

public class Person
{
    public string Name { get; set; }
}
Posted by: Guest on June-08-2021

C# Answers by Framework

Browse Popular Code Answers by Language